Search in sources :

Example 1 with ConjureRefreshLocksResponse

use of com.palantir.atlasdb.timelock.api.ConjureRefreshLocksResponse in project atlasdb by palantir.

the class LockLeaseService method refreshTokens.

private Set<LeasedLockToken> refreshTokens(Set<LeasedLockToken> leasedTokens) {
    if (leasedTokens.isEmpty()) {
        return leasedTokens;
    }
    ConjureRefreshLocksResponse refreshLockResponse = delegate.refreshLocks(ConjureRefreshLocksRequest.of(serverTokens(leasedTokens)));
    Lease lease = refreshLockResponse.getLease();
    Set<LeasedLockToken> refreshedTokens = leasedTokens.stream().filter(t -> refreshLockResponse.getRefreshedTokens().contains(t.serverToken())).collect(Collectors.toSet());
    refreshedTokens.forEach(t -> t.updateLease(lease));
    return refreshedTokens;
}
Also used : LockImmutableTimestampResponse(com.palantir.lock.v2.LockImmutableTimestampResponse) StartTransactionResponseV4(com.palantir.lock.v2.StartTransactionResponseV4) GetCommitTimestampsRequest(com.palantir.atlasdb.timelock.api.GetCommitTimestampsRequest) ConjureRefreshLocksResponse(com.palantir.atlasdb.timelock.api.ConjureRefreshLocksResponse) ConjureStartTransactionsResponse(com.palantir.atlasdb.timelock.api.ConjureStartTransactionsResponse) ConjureStartTransactionsRequest(com.palantir.atlasdb.timelock.api.ConjureStartTransactionsRequest) LeaderTime(com.palantir.lock.v2.LeaderTime) WaitForLocksResponse(com.palantir.lock.v2.WaitForLocksResponse) GetCommitTimestampsResponse(com.palantir.atlasdb.timelock.api.GetCommitTimestampsResponse) Lease(com.palantir.lock.v2.Lease) LockResponse(com.palantir.lock.v2.LockResponse) ConjureLockToken(com.palantir.atlasdb.timelock.api.ConjureLockToken) LockToken(com.palantir.lock.v2.LockToken) LockWatchVersion(com.palantir.lock.watch.LockWatchVersion) Set(java.util.Set) ConjureUnlockRequest(com.palantir.atlasdb.timelock.api.ConjureUnlockRequest) ConjureRefreshLocksRequest(com.palantir.atlasdb.timelock.api.ConjureRefreshLocksRequest) UUID(java.util.UUID) Collectors(java.util.stream.Collectors) Sets(com.google.common.collect.Sets) LockRequest(com.palantir.lock.v2.LockRequest) Optional(java.util.Optional) VisibleForTesting(com.google.common.annotations.VisibleForTesting) WaitForLocksRequest(com.palantir.lock.v2.WaitForLocksRequest) Preconditions(com.palantir.logsafe.Preconditions) Lease(com.palantir.lock.v2.Lease) ConjureRefreshLocksResponse(com.palantir.atlasdb.timelock.api.ConjureRefreshLocksResponse)

Example 2 with ConjureRefreshLocksResponse

use of com.palantir.atlasdb.timelock.api.ConjureRefreshLocksResponse in project atlasdb by palantir.

the class LockDiagnosticConjureTimelockService method refreshLocks.

@Override
public ConjureRefreshLocksResponse refreshLocks(AuthHeader authHeader, String namespace, ConjureRefreshLocksRequest request) {
    ConjureRefreshLocksResponse response = conjureDelegate.refreshLocks(authHeader, namespace, request);
    localLockTracker.logRefreshResponse(request.getTokens(), response);
    return response;
}
Also used : ConjureRefreshLocksResponse(com.palantir.atlasdb.timelock.api.ConjureRefreshLocksResponse)

Aggregations

ConjureRefreshLocksResponse (com.palantir.atlasdb.timelock.api.ConjureRefreshLocksResponse)2 VisibleForTesting (com.google.common.annotations.VisibleForTesting)1 Sets (com.google.common.collect.Sets)1 ConjureLockToken (com.palantir.atlasdb.timelock.api.ConjureLockToken)1 ConjureRefreshLocksRequest (com.palantir.atlasdb.timelock.api.ConjureRefreshLocksRequest)1 ConjureStartTransactionsRequest (com.palantir.atlasdb.timelock.api.ConjureStartTransactionsRequest)1 ConjureStartTransactionsResponse (com.palantir.atlasdb.timelock.api.ConjureStartTransactionsResponse)1 ConjureUnlockRequest (com.palantir.atlasdb.timelock.api.ConjureUnlockRequest)1 GetCommitTimestampsRequest (com.palantir.atlasdb.timelock.api.GetCommitTimestampsRequest)1 GetCommitTimestampsResponse (com.palantir.atlasdb.timelock.api.GetCommitTimestampsResponse)1 LeaderTime (com.palantir.lock.v2.LeaderTime)1 Lease (com.palantir.lock.v2.Lease)1 LockImmutableTimestampResponse (com.palantir.lock.v2.LockImmutableTimestampResponse)1 LockRequest (com.palantir.lock.v2.LockRequest)1 LockResponse (com.palantir.lock.v2.LockResponse)1 LockToken (com.palantir.lock.v2.LockToken)1 StartTransactionResponseV4 (com.palantir.lock.v2.StartTransactionResponseV4)1 WaitForLocksRequest (com.palantir.lock.v2.WaitForLocksRequest)1 WaitForLocksResponse (com.palantir.lock.v2.WaitForLocksResponse)1 LockWatchVersion (com.palantir.lock.watch.LockWatchVersion)1