Search in sources :

Example 1 with LockImmutableTimestampRequest

use of com.palantir.lock.v2.LockImmutableTimestampRequest in project atlasdb by palantir.

the class TimestampDecoratingTimelockServiceTest method methodsNotOnTimestampServiceRoutedToDelegateService.

@Test
public void methodsNotOnTimestampServiceRoutedToDelegateService() {
    decoratingService.currentTimeMillis();
    verify(delegate).currentTimeMillis();
    LockImmutableTimestampRequest immutableTimestampRequest = LockImmutableTimestampRequest.create();
    decoratingService.lockImmutableTimestamp(immutableTimestampRequest);
    verify(delegate).lockImmutableTimestamp(eq(immutableTimestampRequest));
}
Also used : LockImmutableTimestampRequest(com.palantir.lock.v2.LockImmutableTimestampRequest) Test(org.junit.Test)

Example 2 with LockImmutableTimestampRequest

use of com.palantir.lock.v2.LockImmutableTimestampRequest in project atlasdb by palantir.

the class TimeLockClient method lockImmutableTimestamp.

@Override
public LockImmutableTimestampResponse lockImmutableTimestamp(LockImmutableTimestampRequest request) {
    LockImmutableTimestampResponse response = executeOnTimeLock(() -> delegate.lockImmutableTimestamp(request));
    lockRefresher.registerLock(response.getLock());
    return response;
}
Also used : LockImmutableTimestampResponse(com.palantir.lock.v2.LockImmutableTimestampResponse)

Example 3 with LockImmutableTimestampRequest

use of com.palantir.lock.v2.LockImmutableTimestampRequest in project atlasdb by palantir.

the class AsyncTimelockServiceImpl method lockImmutableTimestamp.

@Override
public LockImmutableTimestampResponse lockImmutableTimestamp(LockImmutableTimestampRequest request) {
    long timestamp = timestampService.getFreshTimestamp();
    // this will always return synchronously
    LockToken token = lockService.lockImmutableTimestamp(request.getRequestId(), timestamp).get();
    long immutableTs = lockService.getImmutableTimestamp().orElse(timestamp);
    return LockImmutableTimestampResponse.of(immutableTs, token);
}
Also used : LockToken(com.palantir.lock.v2.LockToken)

Aggregations

LockImmutableTimestampRequest (com.palantir.lock.v2.LockImmutableTimestampRequest)1 LockImmutableTimestampResponse (com.palantir.lock.v2.LockImmutableTimestampResponse)1 LockToken (com.palantir.lock.v2.LockToken)1 Test (org.junit.Test)1