@Test public void doesNotCallSupplierForExistingRequest() { awaitedLocks.getExistingOrAwait(REQUEST_1, () -> new AsyncResult<>()); Supplier<AsyncResult<Void>> supplier = mock(Supplier.class); awaitedLocks.getExistingOrAwait(REQUEST_1, supplier); verifyNoMoreInteractions(supplier); }
public AsyncResult<Void> getExistingOrAwait( UUID requestId, Supplier<AsyncResult<Void>> lockAwaiter) { AsyncResult<Void> result = requestsById.computeIfAbsent( requestId, ignored -> lockAwaiter.get()); registerCompletionHandler(requestId, result); return result; }
AwaitedLocksCollection { public AsyncResult<Void> getExistingOrAwait( UUID requestId, Supplier<AsyncResult<Void>> lockAwaiter) { AsyncResult<Void> result = requestsById.computeIfAbsent( requestId, ignored -> lockAwaiter.get()); registerCompletionHandler(requestId, result); return result; } }
AwaitedLocksCollection { public AsyncResult<Void> getExistingOrAwait( UUID requestId, Supplier<AsyncResult<Void>> lockAwaiter) { AsyncResult<Void> result = requestsById.computeIfAbsent( requestId, ignored -> lockAwaiter.get()); registerCompletionHandler(requestId, result); return result; }  }
AwaitedLocksCollection { public AsyncResult<Void> getExistingOrAwait( UUID requestId, Supplier<AsyncResult<Void>> lockAwaiter) { AsyncResult<Void> result = requestsById.computeIfAbsent( requestId, ignored -> lockAwaiter.get()); registerCompletionHandler(requestId, result); return result; }  AsyncResult<Void> getExistingOrAwait(
            UUID requestId,
            Supplier<AsyncResult<Void>> lockAwaiter); }
AwaitedLocksCollection { public AsyncResult<Void> getExistingOrAwait( UUID requestId, Supplier<AsyncResult<Void>> lockAwaiter) { AsyncResult<Void> result = requestsById.computeIfAbsent( requestId, ignored -> lockAwaiter.get()); registerCompletionHandler(requestId, result); return result; }  AsyncResult<Void> getExistingOrAwait(
            UUID requestId,
            Supplier<AsyncResult<Void>> lockAwaiter);  }