@Test public void delegatesInterruptibleOperations() throws InterruptedException { acceptingService.lock(CLIENT, LOCK_REQUEST); verify(delegate, times(1)).lock(CLIENT, LOCK_REQUEST); }
@Nullable @Override public LockRefreshToken lock(@PathParam("client") String client, LockRequest request) throws InterruptedException { return callWithTimeLimit( () -> delegate.lock(client, request), ImmutableLockRequestSpecification.of("lock", client, request)); }
BlockingTimeLimitedLockService implements CloseableLockService { @Nullable @Override public LockRefreshToken lock(@PathParam("client") String client, LockRequest request) throws InterruptedException { return callWithTimeLimit( () -> delegate.lock(client, request), ImmutableLockRequestSpecification.of("lock", client, request)); } }
BlockingTimeLimitedLockService implements CloseableLockService { @Nullable @Override public LockRefreshToken lock(@PathParam("client") String client, LockRequest request) throws InterruptedException { return callWithTimeLimit( () -> delegate.lock(client, request), ImmutableLockRequestSpecification.of("lock", client, request)); } @VisibleForTesting  BlockingTimeLimitedLockService(
            CloseableLockService delegate,
            TimeLimiter timeLimiter,
            long blockingTimeLimitMillis); }
BlockingTimeLimitedLockService implements CloseableLockService { @Nullable @Override public LockRefreshToken lock(@PathParam("client") String client, LockRequest request) throws InterruptedException { return callWithTimeLimit( () -> delegate.lock(client, request), ImmutableLockRequestSpecification.of("lock", client, request)); } @VisibleForTesting  BlockingTimeLimitedLockService(
            CloseableLockService delegate,
            TimeLimiter timeLimiter,
            long blockingTimeLimitMillis); static BlockingTimeLimitedLockService create(CloseableLockService lockService,
            long blockingTimeLimitMillis); @Nullable @Override LockRefreshToken lock(@PathParam("client") String client, LockRequest request); @Override HeldLocksToken lockAndGetHeldLocks(@PathParam("client") String client, LockRequest request); @Override Set<LockRefreshToken> refreshLockRefreshTokens(Iterable<LockRefreshToken> tokens); @Override LockResponse lockWithFullLockResponse(LockClient client, LockRequest request); @Override boolean unlock(HeldLocksToken token); @Override boolean unlock(LockRefreshToken token); @Override boolean unlockSimple(SimpleHeldLocksToken token); @Override boolean unlockAndFreeze(HeldLocksToken token); @Override Set<HeldLocksToken> getTokens(LockClient client); @Override Set<HeldLocksToken> refreshTokens(Iterable<HeldLocksToken> tokens); @Nullable @Override HeldLocksGrant refreshGrant(HeldLocksGrant grant); @Nullable @Override HeldLocksGrant refreshGrant(BigInteger grantId); @Override HeldLocksGrant convertToGrant(HeldLocksToken token); @Override HeldLocksToken useGrant(LockClient client, HeldLocksGrant grant); @Override HeldLocksToken useGrant(LockClient client, BigInteger grantId); @Nullable @Override Long getMinLockedInVersionId(@PathParam("client") String client); @Nullable @Override Long getMinLockedInVersionId(); @Override Long getMinLockedInVersionId(LockClient client); @Override LockServerOptions getLockServerOptions(); @Override long currentTimeMillis(); @Override void logCurrentState(); @Override void close(); }
BlockingTimeLimitedLockService implements CloseableLockService { @Nullable @Override public LockRefreshToken lock(@PathParam("client") String client, LockRequest request) throws InterruptedException { return callWithTimeLimit( () -> delegate.lock(client, request), ImmutableLockRequestSpecification.of("lock", client, request)); } @VisibleForTesting  BlockingTimeLimitedLockService(
            CloseableLockService delegate,
            TimeLimiter timeLimiter,
            long blockingTimeLimitMillis); static BlockingTimeLimitedLockService create(CloseableLockService lockService,
            long blockingTimeLimitMillis); @Nullable @Override LockRefreshToken lock(@PathParam("client") String client, LockRequest request); @Override HeldLocksToken lockAndGetHeldLocks(@PathParam("client") String client, LockRequest request); @Override Set<LockRefreshToken> refreshLockRefreshTokens(Iterable<LockRefreshToken> tokens); @Override LockResponse lockWithFullLockResponse(LockClient client, LockRequest request); @Override boolean unlock(HeldLocksToken token); @Override boolean unlock(LockRefreshToken token); @Override boolean unlockSimple(SimpleHeldLocksToken token); @Override boolean unlockAndFreeze(HeldLocksToken token); @Override Set<HeldLocksToken> getTokens(LockClient client); @Override Set<HeldLocksToken> refreshTokens(Iterable<HeldLocksToken> tokens); @Nullable @Override HeldLocksGrant refreshGrant(HeldLocksGrant grant); @Nullable @Override HeldLocksGrant refreshGrant(BigInteger grantId); @Override HeldLocksGrant convertToGrant(HeldLocksToken token); @Override HeldLocksToken useGrant(LockClient client, HeldLocksGrant grant); @Override HeldLocksToken useGrant(LockClient client, BigInteger grantId); @Nullable @Override Long getMinLockedInVersionId(@PathParam("client") String client); @Nullable @Override Long getMinLockedInVersionId(); @Override Long getMinLockedInVersionId(LockClient client); @Override LockServerOptions getLockServerOptions(); @Override long currentTimeMillis(); @Override void logCurrentState(); @Override void close();  }