use of io.vertx.core.shareddata.impl.AsynchronousCounter in project vert.x by eclipse.
the class FakeClusterManager method getCounter.
@Override
public void getCounter(String name, Handler<AsyncResult<Counter>> resultHandler) {
AtomicLong counter = new AtomicLong();
AtomicLong prev = counters.putIfAbsent(name, counter);
if (prev != null) {
counter = prev;
}
AtomicLong theCounter = counter;
Context context = vertx.getOrCreateContext();
context.runOnContext(v -> resultHandler.handle(Future.succeededFuture(new AsynchronousCounter(vertx, theCounter))));
}
Aggregations