Examples of writeLock()


Examples of java.util.concurrent.locks.ReentrantReadWriteLock.writeLock()

        this.applicationValidator = applicationValidator;
        rootResources = new LinkedList<ResourceRecord>();
        resourceRecordsFactory = new ResourceRecordFactory(factoryRegistry);
        ReadWriteLock readWriteLock = new ReentrantReadWriteLock();
        readersLock = readWriteLock.readLock();
        writersLock = readWriteLock.writeLock();
        uriToResourceCache.put(Boolean.TRUE,
                               new SoftConcurrentMap<String, ArrayList<ResourceRecord>>());
        uriToResourceCache.put(Boolean.FALSE,
                               new SoftConcurrentMap<String, ArrayList<ResourceRecord>>());
    }
View Full Code Here

Examples of java.util.concurrent.locks.ReentrantReadWriteLock.writeLock()

        }
        this.lifecycleManagerRegistry = lifecycleManagerRegistry;
        this.cacheByClass = new HashMap<Class<?>, ResourceRecord>();
        ReadWriteLock readWriteLock = new ReentrantReadWriteLock();
        readersLock = readWriteLock.readLock();
        writersLock = readWriteLock.writeLock();
    }

    /**
     * Gets a resource record from a cache of records for the specified resource
     * class. If there is no record in the cache, then a new record is created
View Full Code Here

Examples of java.util.concurrent.locks.ReentrantReadWriteLock.writeLock()

    * @param exclusive if true, a write (exclusive) lock is attempted, otherwise a read (shared) lock is used.
    */
   public void acquireLock(Object key, boolean exclusive) {
      ReentrantReadWriteLock lock = getLock(key);
      if (exclusive) {
         lock.writeLock().lock();
         if (trace) log.tracef("WL acquired for '%s'", key);
      } else {
         lock.readLock().lock();
         if (trace) log.tracef("RL acquired for '%s'", key);
      }
View Full Code Here

Examples of java.util.concurrent.locks.ReentrantReadWriteLock.writeLock()

   public boolean acquireLock(Object key, boolean exclusive, long millis) {
      ReentrantReadWriteLock lock = getLock(key);
      try {
         if (exclusive) {
            boolean success = lock.writeLock().tryLock(millis, TimeUnit.MILLISECONDS);
            if (success && trace) log.tracef("WL acquired for '%s'", key);
            return success;
         } else {
            boolean success = lock.readLock().tryLock(millis, TimeUnit.MILLISECONDS);
            if (success && trace) log.tracef("RL acquired for '%s'", key);
View Full Code Here

Examples of java.util.concurrent.locks.ReentrantReadWriteLock.writeLock()

   public void upgradeLock(Object key) {
      ReentrantReadWriteLock lock = getLock(key);
      lock.readLock().unlock();
      // another thread could come here and take the RL or WL, forcing us to wait
      lock.writeLock().lock();
      if (trace) log.tracef("RL upgraded to WL for '%s'", key);
   }

   public void downgradeLock(Object key) {
      ReentrantReadWriteLock lock = getLock(key);
View Full Code Here

Examples of jersey.repackaged.jsr166e.StampedLock.writeLock()

     * field under lock.
     */
    final boolean lockedRemoveAll(Collection<?> c, int origin, int bound) {
        boolean removed = false;
        final StampedLock lock = this.lock;
        long stamp = lock.writeLock();
        try {
            int n = count;
            int fence = bound < 0 || bound > n ? n : bound;
            if (origin >= 0 && origin < fence) {
                for (Object x : c) {
View Full Code Here

Examples of lineage2.gameserver.instancemanager.commission.CommissionItemContainer.writeLock()

    List<CommissionItemInfo> list = new ArrayList<>();
    Connection con = null;
    PreparedStatement statement = null;
    ResultSet rset = null;
    CommissionItemContainer container = CommissionShopManager.getInstance().getContainer();
    container.writeLock();
    try
    {
      con = DatabaseFactory.getInstance().getConnection();
      statement = con.prepareStatement(SELECT_EXPIRED_ITEMS);
      statement.setLong(1, expireTime);
View Full Code Here

Examples of lineage2.gameserver.model.items.PcFreight.writeLock()

    }
    PcInventory inventory = player.getInventory();
    PcFreight freight = new PcFreight(_objectId);
    freight.restore();
    inventory.writeLock();
    freight.writeLock();
    try
    {
      int slotsleft = 0;
      long adenaDeposit = 0;
      slotsleft = Config.FREIGHT_SLOTS - freight.getSize();
View Full Code Here

Examples of lineage2.gameserver.model.items.PcInventory.writeLock()

      return;
    }
    PcInventory inventory = player.getInventory();
    PcFreight freight = new PcFreight(_objectId);
    freight.restore();
    inventory.writeLock();
    freight.writeLock();
    try
    {
      int slotsleft = 0;
      long adenaDeposit = 0;
View Full Code Here

Examples of lineage2.gameserver.model.items.Warehouse.writeLock()

      _log.warn("Error retrieving a warehouse object for char " + activeChar.getName() + " - using warehouse type: " + activeChar.getUsingWarehouseType());
      return;
    }
    PcInventory inventory = activeChar.getInventory();
    inventory.writeLock();
    warehouse.writeLock();
    try
    {
      long weight = 0;
      int slots = 0;
      for (int i = 0; i < _count; i++)
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.