org.apache.hadoop.io.retry.UnreliableInterface.FatalException Java Examples

The following examples show how to use org.apache.hadoop.io.retry.UnreliableInterface.FatalException. 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: TestRetryProxy.java    From hadoop with Apache License 2.0 6 votes vote down vote up
@Test
public void testRetryByException() throws UnreliableException {
  Map<Class<? extends Exception>, RetryPolicy> exceptionToPolicyMap =
    Collections.<Class<? extends Exception>, RetryPolicy>singletonMap(FatalException.class, TRY_ONCE_THEN_FAIL);
  
  UnreliableInterface unreliable = (UnreliableInterface)
    RetryProxy.create(UnreliableInterface.class, unreliableImpl,
                      retryByException(RETRY_FOREVER, exceptionToPolicyMap));
  unreliable.failsOnceThenSucceeds();
  try {
    unreliable.alwaysFailsWithFatalException();
    fail("Should fail");
  } catch (FatalException e) {
    // expected
  }
}
 
Example #2
Source File: TestRetryProxy.java    From big-c with Apache License 2.0 6 votes vote down vote up
@Test
public void testRetryByException() throws UnreliableException {
  Map<Class<? extends Exception>, RetryPolicy> exceptionToPolicyMap =
    Collections.<Class<? extends Exception>, RetryPolicy>singletonMap(FatalException.class, TRY_ONCE_THEN_FAIL);
  
  UnreliableInterface unreliable = (UnreliableInterface)
    RetryProxy.create(UnreliableInterface.class, unreliableImpl,
                      retryByException(RETRY_FOREVER, exceptionToPolicyMap));
  unreliable.failsOnceThenSucceeds();
  try {
    unreliable.alwaysFailsWithFatalException();
    fail("Should fail");
  } catch (FatalException e) {
    // expected
  }
}
 
Example #3
Source File: TestRetryProxy.java    From hadoop with Apache License 2.0 5 votes vote down vote up
@Test
public void testRetryByRemoteException() {
  Map<Class<? extends Exception>, RetryPolicy> exceptionToPolicyMap =
    Collections.<Class<? extends Exception>, RetryPolicy>singletonMap(FatalException.class, TRY_ONCE_THEN_FAIL);
  
  UnreliableInterface unreliable = (UnreliableInterface)
    RetryProxy.create(UnreliableInterface.class, unreliableImpl,
                      retryByRemoteException(RETRY_FOREVER, exceptionToPolicyMap));
  try {
    unreliable.alwaysFailsWithRemoteFatalException();
    fail("Should fail");
  } catch (RemoteException e) {
    // expected
  }
}
 
Example #4
Source File: TestRetryProxy.java    From big-c with Apache License 2.0 5 votes vote down vote up
@Test
public void testRetryByRemoteException() {
  Map<Class<? extends Exception>, RetryPolicy> exceptionToPolicyMap =
    Collections.<Class<? extends Exception>, RetryPolicy>singletonMap(FatalException.class, TRY_ONCE_THEN_FAIL);
  
  UnreliableInterface unreliable = (UnreliableInterface)
    RetryProxy.create(UnreliableInterface.class, unreliableImpl,
                      retryByRemoteException(RETRY_FOREVER, exceptionToPolicyMap));
  try {
    unreliable.alwaysFailsWithRemoteFatalException();
    fail("Should fail");
  } catch (RemoteException e) {
    // expected
  }
}
 
Example #5
Source File: TestRetryProxy.java    From RDFS with Apache License 2.0 5 votes vote down vote up
public void testRetryByException() throws UnreliableException {
  Map<Class<? extends Exception>, RetryPolicy> exceptionToPolicyMap =
    Collections.<Class<? extends Exception>, RetryPolicy>singletonMap(FatalException.class, TRY_ONCE_THEN_FAIL);
  
  UnreliableInterface unreliable = (UnreliableInterface)
    RetryProxy.create(UnreliableInterface.class, unreliableImpl,
                      retryByException(RETRY_FOREVER, exceptionToPolicyMap));
  unreliable.failsOnceThenSucceeds();
  try {
    unreliable.alwaysFailsWithFatalException();
    fail("Should fail");
  } catch (FatalException e) {
    // expected
  }
}
 
Example #6
Source File: TestRetryProxy.java    From RDFS with Apache License 2.0 5 votes vote down vote up
public void testRetryByRemoteException() throws UnreliableException {
  Map<Class<? extends Exception>, RetryPolicy> exceptionToPolicyMap =
    Collections.<Class<? extends Exception>, RetryPolicy>singletonMap(FatalException.class, TRY_ONCE_THEN_FAIL);
  
  UnreliableInterface unreliable = (UnreliableInterface)
    RetryProxy.create(UnreliableInterface.class, unreliableImpl,
                      retryByRemoteException(RETRY_FOREVER, exceptionToPolicyMap));
  try {
    unreliable.alwaysFailsWithRemoteFatalException();
    fail("Should fail");
  } catch (RemoteException e) {
    // expected
  }
}
 
Example #7
Source File: TestRetryProxy.java    From hadoop-gpu with Apache License 2.0 5 votes vote down vote up
public void testRetryByException() throws UnreliableException {
  Map<Class<? extends Exception>, RetryPolicy> exceptionToPolicyMap =
    Collections.<Class<? extends Exception>, RetryPolicy>singletonMap(FatalException.class, TRY_ONCE_THEN_FAIL);
  
  UnreliableInterface unreliable = (UnreliableInterface)
    RetryProxy.create(UnreliableInterface.class, unreliableImpl,
                      retryByException(RETRY_FOREVER, exceptionToPolicyMap));
  unreliable.failsOnceThenSucceeds();
  try {
    unreliable.alwaysFailsWithFatalException();
    fail("Should fail");
  } catch (FatalException e) {
    // expected
  }
}
 
Example #8
Source File: TestRetryProxy.java    From hadoop-gpu with Apache License 2.0 5 votes vote down vote up
public void testRetryByRemoteException() throws UnreliableException {
  Map<Class<? extends Exception>, RetryPolicy> exceptionToPolicyMap =
    Collections.<Class<? extends Exception>, RetryPolicy>singletonMap(FatalException.class, TRY_ONCE_THEN_FAIL);
  
  UnreliableInterface unreliable = (UnreliableInterface)
    RetryProxy.create(UnreliableInterface.class, unreliableImpl,
                      retryByRemoteException(RETRY_FOREVER, exceptionToPolicyMap));
  try {
    unreliable.alwaysFailsWithRemoteFatalException();
    fail("Should fail");
  } catch (RemoteException e) {
    // expected
  }
}