org.apache.flink.runtime.throwable.ThrowableType Java Examples

The following examples show how to use org.apache.flink.runtime.throwable.ThrowableType. 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: ThrowableClassifierTest.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
@Test
public void testThrowableType_NonRecoverable() {
	assertEquals(ThrowableType.NonRecoverableError,
		ThrowableClassifier.getThrowableType(new SuppressRestartsException(new Exception(""))));

	assertEquals(ThrowableType.NonRecoverableError,
		ThrowableClassifier.getThrowableType(new NoResourceAvailableException()));
}
 
Example #2
Source File: ThrowableClassifierTest.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
@Test
public void testThrowableType_Recoverable() {
	assertEquals(ThrowableType.RecoverableError,
		ThrowableClassifier.getThrowableType(new Exception("")));
	assertEquals(ThrowableType.RecoverableError,
		ThrowableClassifier.getThrowableType(new ThrowableType_RecoverableFailure_Exception()));
}
 
Example #3
Source File: ThrowableClassifierTest.java    From flink with Apache License 2.0 5 votes vote down vote up
@Test
public void testThrowableType_NonRecoverable() {
	assertEquals(ThrowableType.NonRecoverableError,
		ThrowableClassifier.getThrowableType(new SuppressRestartsException(new Exception(""))));

	assertEquals(ThrowableType.NonRecoverableError,
		ThrowableClassifier.getThrowableType(new NoResourceAvailableException()));
}
 
Example #4
Source File: ThrowableClassifierTest.java    From flink with Apache License 2.0 5 votes vote down vote up
@Test
public void testThrowableType_Recoverable() {
	assertEquals(ThrowableType.RecoverableError,
		ThrowableClassifier.getThrowableType(new Exception("")));
	assertEquals(ThrowableType.RecoverableError,
		ThrowableClassifier.getThrowableType(new ThrowableType_RecoverableFailure_Exception()));
}
 
Example #5
Source File: ThrowableClassifierTest.java    From flink with Apache License 2.0 5 votes vote down vote up
@Test
public void testFindThrowableOfThrowableType() {
	// no throwable type
	assertFalse(ThrowableClassifier.findThrowableOfThrowableType(
		new Exception(),
		ThrowableType.RecoverableError).isPresent());

	// no recoverable throwable type
	assertFalse(ThrowableClassifier.findThrowableOfThrowableType(
		new ThrowableType_PartitionDataMissingError_Exception(),
		ThrowableType.RecoverableError).isPresent());

	// direct recoverable throwable
	assertTrue(ThrowableClassifier.findThrowableOfThrowableType(
		new ThrowableType_RecoverableFailure_Exception(),
		ThrowableType.RecoverableError).isPresent());

	// nested recoverable throwable
	assertTrue(ThrowableClassifier.findThrowableOfThrowableType(
		new Exception(new ThrowableType_RecoverableFailure_Exception()),
		ThrowableType.RecoverableError).isPresent());

	// inherit recoverable throwable
	assertTrue(ThrowableClassifier.findThrowableOfThrowableType(
		new Sub_ThrowableType_RecoverableFailure_Exception(),
		ThrowableType.RecoverableError).isPresent());
}
 
Example #6
Source File: ThrowableClassifierTest.java    From Flink-CEPplus with Apache License 2.0 4 votes vote down vote up
@Test
public void testThrowableType_EnvironmentError() {
	assertEquals(ThrowableType.EnvironmentError,
		ThrowableClassifier.getThrowableType(new ThrowableType_EnvironmentError_Exception()));
}
 
Example #7
Source File: ThrowableClassifierTest.java    From Flink-CEPplus with Apache License 2.0 4 votes vote down vote up
@Test
public void testThrowableType_PartitionDataMissingError() {
	assertEquals(ThrowableType.PartitionDataMissingError,
		ThrowableClassifier.getThrowableType(new ThrowableType_PartitionDataMissingError_Exception()));
}
 
Example #8
Source File: ThrowableClassifierTest.java    From Flink-CEPplus with Apache License 2.0 4 votes vote down vote up
@Test
public void testThrowableType_InheritError() {
	assertEquals(ThrowableType.PartitionDataMissingError,
		ThrowableClassifier.getThrowableType(new Sub_ThrowableType_PartitionDataMissingError_Exception()));
}
 
Example #9
Source File: ExecutionFailureHandler.java    From flink with Apache License 2.0 4 votes vote down vote up
@VisibleForTesting
static boolean isUnrecoverableError(Throwable cause) {
	Optional<Throwable> unrecoverableError = ThrowableClassifier.findThrowableOfThrowableType(
		cause, ThrowableType.NonRecoverableError);
	return unrecoverableError.isPresent();
}
 
Example #10
Source File: ThrowableClassifierTest.java    From flink with Apache License 2.0 4 votes vote down vote up
@Test
public void testThrowableType_EnvironmentError() {
	assertEquals(ThrowableType.EnvironmentError,
		ThrowableClassifier.getThrowableType(new ThrowableType_EnvironmentError_Exception()));
}
 
Example #11
Source File: ThrowableClassifierTest.java    From flink with Apache License 2.0 4 votes vote down vote up
@Test
public void testThrowableType_PartitionDataMissingError() {
	assertEquals(ThrowableType.PartitionDataMissingError,
		ThrowableClassifier.getThrowableType(new ThrowableType_PartitionDataMissingError_Exception()));
}
 
Example #12
Source File: ThrowableClassifierTest.java    From flink with Apache License 2.0 4 votes vote down vote up
@Test
public void testThrowableType_InheritError() {
	assertEquals(ThrowableType.PartitionDataMissingError,
		ThrowableClassifier.getThrowableType(new Sub_ThrowableType_PartitionDataMissingError_Exception()));
}
 
Example #13
Source File: ExecutionFailureHandler.java    From flink with Apache License 2.0 4 votes vote down vote up
@VisibleForTesting
static boolean isUnrecoverableError(Throwable cause) {
	Optional<Throwable> unrecoverableError = ThrowableClassifier.findThrowableOfThrowableType(
		cause, ThrowableType.NonRecoverableError);
	return unrecoverableError.isPresent();
}