Search in sources :

Example 1 with TransactionLockWatchFailedException

use of com.palantir.atlasdb.transaction.api.TransactionLockWatchFailedException in project atlasdb by palantir.

the class ValidatingTransactionScopedCache method failAndLog.

private void failAndLog(Arg<?>... args) {
    SafeRuntimeException runtimeException = new SafeRuntimeException("I exist to show you the stacktrace");
    log.error("Reading from lock watch cache returned a different result to a remote read - this indicates there " + "is a corruption bug in the caching logic", Arrays.stream(args).collect(Collectors.toList()), runtimeException);
    failureCallback.run();
    throw new TransactionLockWatchFailedException("Failed lock watch cache validation - will retry without caching");
}
Also used : SafeRuntimeException(com.palantir.logsafe.exceptions.SafeRuntimeException) TransactionLockWatchFailedException(com.palantir.atlasdb.transaction.api.TransactionLockWatchFailedException)

Example 2 with TransactionLockWatchFailedException

use of com.palantir.atlasdb.transaction.api.TransactionLockWatchFailedException in project atlasdb by palantir.

the class ResilientLockWatchProxyTest method lockWatchFailedExceptionDoesNotCauseFallbackToBeUsed.

@Test
public void lockWatchFailedExceptionDoesNotCauseFallbackToBeUsed() {
    TransactionLockWatchFailedException lockWatchFailedException = new TransactionLockWatchFailedException("fail");
    when(defaultCache.getCommitUpdate(anyLong())).thenThrow(lockWatchFailedException);
    assertThatThrownBy(() -> proxyEventCache.getCommitUpdate(0L)).isEqualTo(lockWatchFailedException);
    proxyEventCache.lastKnownVersion();
    verify(defaultCache).lastKnownVersion();
    verify(fallbackCache, never()).lastKnownVersion();
}
Also used : TransactionLockWatchFailedException(com.palantir.atlasdb.transaction.api.TransactionLockWatchFailedException) Test(org.junit.Test)

Aggregations

TransactionLockWatchFailedException (com.palantir.atlasdb.transaction.api.TransactionLockWatchFailedException)2 SafeRuntimeException (com.palantir.logsafe.exceptions.SafeRuntimeException)1 Test (org.junit.Test)1