Code example for ConcurrentMap

Methods: size

0
      if (existingLock != null) lock = existingLock;
      return lock;
   } 
 
   public int getNumLocksHeld() { 
      return locks.size();
   } 
 
   public int size() { 
      return locks.size();
   } 
 
   public Lock acquireLock(Object key, long timeout, TimeUnit unit) throws InterruptedException {
      while (true) { 
         Lock lock = getLock(key);
         boolean locked = false;
         try { 
            locked = lock.tryLock(timeout, unit);
         } catch (InterruptedException ie) {
            safeRelease(lock);
            throw ie;