Example usage for io.vertx.core.shareddata.impl AsynchronousCounter AsynchronousCounter

List of usage examples for io.vertx.core.shareddata.impl AsynchronousCounter AsynchronousCounter

Introduction

In this page you can find the example usage for io.vertx.core.shareddata.impl AsynchronousCounter AsynchronousCounter.

Prototype

public AsynchronousCounter(VertxInternal vertx) 

Source Link

Usage

From source file:org.vertx.java.resourceadapter.FakeClusterManager.java

License:Open Source License

@Override
public void getCounter(String name, Handler<AsyncResult<Counter>> resultHandler) {
    Counter counter = new AsynchronousCounter(vertx);
    Counter prev = counters.putIfAbsent(name, counter);
    if (prev != null) {
        counter = prev;/*from   ww  w  .ja  v a  2s  . co  m*/
    }
    Counter theCounter = counter;
    Context context = vertx.getOrCreateContext();
    context.runOnContext(v -> resultHandler.handle(Future.completedFuture(theCounter)));
}