Package java.util.concurrent.atomic

Examples of java.util.concurrent.atomic.AtomicInteger.decrementAndGet()


  /** Release a previously saved commit point */
  public synchronized void releaseCommitPoint(Long indexCommitVersion) {
    AtomicInteger reserveCount = savedCommits.get(indexCommitVersion);
    if (reserveCount == null) return;// this should not happen
    if (reserveCount.decrementAndGet() <= 0) {
      savedCommits.remove(indexCommitVersion);
    }
  }


View Full Code Here


    // clone the BitVector, create a new deletedDocsRef
    if (deletedDocsRef.get() > 1) {
      AtomicInteger oldRef = deletedDocsRef;
      deletedDocs = cloneDeletedDocs(deletedDocs);
      deletedDocsRef = new AtomicInteger(1);
      oldRef.decrementAndGet();
    }
    deletedDocsDirty = true;
    if (!deletedDocs.getAndSet(docNum)) {
      pendingDeleteCount++;
    }
View Full Code Here

    node_monitors.putIfAbsent(caller, new AtomicInteger());
    AtomicInteger ami = node_monitors.get(caller);
    if (on) {
      ami.incrementAndGet();
    } else {
      ami.decrementAndGet();
    }
  }

  /*==================== Monitoring of node changes in general ==========*/

 
View Full Code Here

    for (Map.Entry<EHandle,AtomicInteger> ent : node_monitors.entrySet()) {
      EHandle handle = ent.getKey();
      AtomicInteger howmany = ent.getValue();
     
      ETuple nd = ETuple.make(am_nodedown, this.node());
      while (howmany.decrementAndGet() >= 0) {     
        handle.send(sender, nd);
      }
    }
   
    node_monitors.clear();
View Full Code Here

    if (!client.hasError()) {
      getQueue(connection).put(client);
    } else {
      AtomicInteger counter = _numberOfConnections.get(connection.getHost());
      if (counter != null) {
        counter.decrementAndGet();
      }
    }
  }

  @SuppressWarnings({ "rawtypes", "unchecked" })
View Full Code Here

    @Override
    public void onError(Exception exception) {
      AtomicInteger counter = _pool._numberOfConnections.get(_connection.getHost());
      if (counter != null) {
        counter.decrementAndGet();
      }
      _realCallback.onError(exception);
      _pool.closeAndRemoveTransport(_client);
    }
  }
View Full Code Here

      // "head Norm" can be changed:
      assert refCount == 1;
      final AtomicInteger oldRef = bytesRef;
      bytes = owner.cloneNormBytes(bytes);
      bytesRef = new AtomicInteger(1);
      oldRef.decrementAndGet();
    }
    dirty = true;
    return bytes;
  }
 
View Full Code Here

    // clone the BitVector, create a new deletedDocsRef
    if (deletedDocsRef.get() > 1) {
      AtomicInteger oldRef = deletedDocsRef;
      deletedDocs = cloneDeletedDocs(deletedDocs);
      deletedDocsRef = new AtomicInteger(1);
      oldRef.decrementAndGet();
    }
    deletedDocsDirty = true;
    if (!deletedDocs.getAndSet(docNum)) {
      pendingDeleteCount++;
    }
View Full Code Here

        channel.getAsyncIn().write(new Buffer(message))
                .addListener(new SshFutureListener<IoWriteFuture>() {
                    public void operationComplete(IoWriteFuture future) {
                        try {
                            if (future.isWritten()) {
                                if (writes.decrementAndGet() > 0) {
                                    channel.getAsyncIn().write(new Buffer(message)).addListener(this);
                                } else {
                                    channel.getAsyncIn().close(false);
                                }
                            } else {
View Full Code Here

                public CloseFuture close(boolean immediately) {
                    final AtomicInteger count = new AtomicInteger(closeables.length);
                    if (closing.compareAndSet(false, true)) {
                        SshFutureListener<CloseFuture> listener = new SshFutureListener<CloseFuture>() {
                            public void operationComplete(CloseFuture f) {
                                if (count.decrementAndGet() == 0) {
                                    future.setClosed();
                                }
                            }
                        };
                        for (Closeable c : closeables) {
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.