builder.addInterceptors(interceptor); handler = builder.build(); assertFalse(handler.shouldRetry(new IOException(), null));
@Test public void testNullRetryResultFromBeforeEval() { @SuppressWarnings("serial") Interceptor interceptor = new Interceptor() { @Override public RetryResult beforeEval(Exception exception) { return null; } @Override public RetryResult afterEval(Exception exception, RetryResult retryResult) { return RetryResult.CONTINUE_EVALUATION; } }; ExceptionHandler handler = ExceptionHandler.newBuilder().addInterceptors(interceptor).build(); thrown.expect(NullPointerException.class); handler.shouldRetry(new Exception(), null); }
@Test public void testNullRetryResultFromAfterEval() { @SuppressWarnings("serial") Interceptor interceptor = new Interceptor() { @Override public RetryResult beforeEval(Exception exception) { return RetryResult.CONTINUE_EVALUATION; } @Override public RetryResult afterEval(Exception exception, RetryResult retryResult) { return null; } }; ExceptionHandler handler = ExceptionHandler.newBuilder().addInterceptors(interceptor).build(); thrown.expect(NullPointerException.class); handler.shouldRetry(new Exception(), null); } }
public static ExceptionHandler build() { return ExceptionHandler.newBuilder() .abortOn(RuntimeException.class) .addInterceptors( DatastoreImpl.EXCEPTION_HANDLER_INTERCEPTOR, TRANSACTION_EXCEPTION_HANDLER_INTERCEPTOR) .build(); }
ExceptionHandler.newBuilder() .abortOn(RuntimeException.class) .addInterceptors(DatastoreImpl.EXCEPTION_HANDLER_INTERCEPTOR) .build(); ExceptionHandler transactionHandler = TransactionExceptionHandler.build();
public static ExceptionHandler build() { return ExceptionHandler.newBuilder() .abortOn(RuntimeException.class) .addInterceptors( DatastoreImpl.EXCEPTION_HANDLER_INTERCEPTOR, TRANSACTION_EXCEPTION_HANDLER_INTERCEPTOR) .build(); }