TimeoutSensitiveLockRpcClient implements LockRpcClient { @Override public Optional<LockRefreshToken> lock(String namespace, String client, LockRequest request) throws InterruptedException { return longTimeoutProxy.lock(namespace, client, request); } TimeoutSensitiveLockRpcClient(ShortAndLongTimeoutServices<LockRpcClient> services); @Override Optional<LockResponse> lockWithFullLockResponse(String namespace, LockClient client, LockRequest request); @Override boolean unlock(String namespace, HeldLocksToken token); @Override boolean unlock(String namespace, LockRefreshToken token); @Override boolean unlockSimple(String namespace, SimpleHeldLocksToken token); @Override boolean unlockAndFreeze(String namespace, HeldLocksToken token); @Override Set<HeldLocksToken> getTokens(String namespace, LockClient client); @Override Set<HeldLocksToken> refreshTokens(String namespace, Iterable<HeldLocksToken> tokens); @Override Optional<HeldLocksGrant> refreshGrant(String namespace, HeldLocksGrant grant); @Override Optional<HeldLocksGrant> refreshGrant(String namespace, BigInteger grantId); @Override HeldLocksGrant convertToGrant(String namespace, HeldLocksToken token); @Override HeldLocksToken useGrant(String namespace, LockClient client, HeldLocksGrant grant); @Override HeldLocksToken useGrant(String namespace, LockClient client, BigInteger grantId); @Override Optional<Long> getMinLockedInVersionId(String namespace); @Override Optional<Long> getMinLockedInVersionId(String namespace, LockClient client); @Override Optional<Long> getMinLockedInVersionId(String namespace, String client); @Override LockServerOptions getLockServerOptions(String namespace); @Override Optional<LockRefreshToken> lock(String namespace, String client, LockRequest request); @Override Optional<HeldLocksToken> lockAndGetHeldLocks(String namespace, String client, LockRequest request); @Override Set<LockRefreshToken> refreshLockRefreshTokens(String namespace, Iterable<LockRefreshToken> tokens); @Override long currentTimeMillis(String namespace); @Override void logCurrentState(String namespace);  }
@Test public void lockHasLongTimeout() throws InterruptedException { sensitiveClient.lock(NAMESPACE, LOCK_CLIENT_STRING, LOCK_REQUEST); verify(longTimeout).lock(NAMESPACE, LOCK_CLIENT_STRING, LOCK_REQUEST); verify(shortTimeout, never()).lock(NAMESPACE, LOCK_CLIENT_STRING, LOCK_REQUEST); }