public SharedDataImpl(VertxInternal vertx, ClusterManager clusterManager) { this.vertx = vertx; this.clusterManager = clusterManager; localAsyncLocks = clusterManager == null ? new LocalAsyncLocks() : null; }
private void getLocalLock(String name, long timeout, Handler<AsyncResult<Lock>> resultHandler) { localAsyncLocks.acquire(vertx.getOrCreateContext(), name, timeout, resultHandler); }
/** * Get a local lock with the specified name with specifying a timeout. The lock will be passed to * the handler when it is available. If the lock is not obtained within the timeout a failure * will be sent to the handler * * @param name the name of the lock * @param timeout the timeout in ms * @param resultHandler the handler */ public void getLockWithTimeout(String name, long timeout, Handler<AsyncResult<Lock>> resultHandler) { Objects.requireNonNull(name, "name"); Objects.requireNonNull(resultHandler, "resultHandler"); Arguments.require(timeout >= 0L, "timeout must be >= 0"); LocalAsyncLocks lock = this.localLocks .computeIfAbsent(name, (n) -> new LocalAsyncLocks()); lock.acquire(this.vertx.getOrCreateContext(),name,timeout, resultHandler); }
public static void reset() { nodes.clear(); asyncMaps.clear(); asyncMultiMaps.clear(); localAsyncLocks = new LocalAsyncLocks(); counters.clear(); syncMaps.clear(); }
@Override public void getLockWithTimeout(String name, long timeout, Handler<AsyncResult<Lock>> resultHandler) { localAsyncLocks.acquire(vertx.getOrCreateContext(), name, timeout, resultHandler); }
public SharedDataImpl(VertxInternal vertx, ClusterManager clusterManager) { this.vertx = vertx; this.clusterManager = clusterManager; localAsyncLocks = clusterManager == null ? new LocalAsyncLocks() : null; }
private void getLocalLock(String name, long timeout, Handler<AsyncResult<Lock>> resultHandler) { localAsyncLocks.acquire(vertx.getOrCreateContext(), name, timeout, resultHandler); }
public static void reset() { nodes.clear(); asyncMaps.clear(); asyncMultiMaps.clear(); localAsyncLocks = new LocalAsyncLocks(); counters.clear(); syncMaps.clear(); }
@Override public void getLockWithTimeout(String name, long timeout, Handler<AsyncResult<Lock>> resultHandler) { localAsyncLocks.acquire(vertx.getOrCreateContext(), name, timeout, resultHandler); }