/** @return {@code true} if entered to busy state. */
  private boolean enterBusy() {
    if (busyLock.readLock().tryLock()) return true;

    if (log.isDebugEnabled())
      log.debug("Failed to enter busy state (exchanger is stopping): " + this);

    return false;
  }
 private void leaveBusy() {
   busyLock.readLock().unlock();
 }
Exemplo n.º 3
0
 /**
  * Create a new SyncMap protecting the given map, and using the given ReadWriteLock to control
  * reader and writer methods.
  */
 public SyncMap(Map map, ReadWriteLock rwl) {
   this(map, rwl.readLock(), rwl.writeLock());
 }
Exemplo n.º 4
0
 /**
  * Create a new SyncSortedSet protecting the given set, and using the given ReadWriteLock to
  * control reader and writer methods.
  */
 public SyncSortedSet(SortedSet set, ReadWriteLock rwl) {
   super(set, rwl.readLock(), rwl.writeLock());
 }