com.couchbase.client.java.error.TemporaryFailureException Java Examples

The following examples show how to use com.couchbase.client.java.error.TemporaryFailureException. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: BaseCouchbaseTableFunction.java    From samza with Apache License 2.0 5 votes vote down vote up
/**
 * Check whether the exception is caused by one of the temporary failure exceptions, which are
 * likely to be retriable.
 * @param exception exception thrown by the table provider
 * @return true if we should retry, otherwise false
 */
public boolean isRetriable(Throwable exception) {
  while (exception != null
      && !(exception instanceof TemporaryFailureException)
      && !(exception instanceof TemporaryLockFailureException)
      && !(exception instanceof TimeoutException)) {
    exception = exception.getCause();
  }
  return exception != null;
}
 
Example #2
Source File: TestCouchbaseTableWriteFunction.java    From samza with Apache License 2.0 5 votes vote down vote up
@Test
public void testIsRetriable() {
  CouchbaseTableWriteFunction writeFunction = createAndInit();
  assertTrue(writeFunction.isRetriable(new TemporaryFailureException()));
  assertTrue(writeFunction.isRetriable(new TemporaryLockFailureException()));
  assertTrue(writeFunction.isRetriable(new SamzaException(new TemporaryLockFailureException())));
  assertTrue(writeFunction.isRetriable(new SamzaException(new TemporaryFailureException())));
  assertTrue(writeFunction.isRetriable(
      new RuntimeException(new SamzaException(new RuntimeException(new TemporaryFailureException())))));
}
 
Example #3
Source File: TestCouchbaseTableReadFunction.java    From samza with Apache License 2.0 5 votes vote down vote up
@Test
public void testIsRetriable() {
  CouchbaseTableReadFunction readFunction = createAndInit();
  assertTrue(readFunction.isRetriable(new TemporaryFailureException()));
  assertTrue(readFunction.isRetriable(new TemporaryLockFailureException()));
  assertTrue(readFunction.isRetriable(new SamzaException(new TemporaryLockFailureException())));
  assertTrue(readFunction.isRetriable(new SamzaException(new TemporaryFailureException())));
  assertTrue(readFunction.isRetriable(
      new RuntimeException(new SamzaException(new RuntimeException(new TemporaryFailureException())))));
}