@Override public void tryHandleCheckpointException(CheckpointMetaData checkpointMetaData, Exception exception) { try { synchronousCheckpointExceptionHandler.tryHandleCheckpointException(checkpointMetaData, exception); } catch (Exception unhandled) { AsynchronousException asyncException = new AsynchronousException(unhandled); owner.handleAsyncException("Failure in asynchronous checkpoint materialization", asyncException); } } }
@Test public void testRethrowingHandler() { DeclineDummyEnvironment environment = new DeclineDummyEnvironment(); CheckpointExceptionHandlerFactory checkpointExceptionHandlerFactory = new CheckpointExceptionHandlerFactory(); CheckpointExceptionHandler exceptionHandler = checkpointExceptionHandlerFactory.createCheckpointExceptionHandler(true, environment); CheckpointMetaData failedCheckpointMetaData = new CheckpointMetaData(42L, 4711L); Exception testException = new Exception("test"); try { exceptionHandler.tryHandleCheckpointException(failedCheckpointMetaData, testException); Assert.fail("Exception not rethrown."); } catch (Exception e) { Assert.assertEquals(testException, e); } Assert.assertNull(environment.getLastDeclinedCheckpointCause()); }
@Test public void testDecliningHandler() { DeclineDummyEnvironment environment = new DeclineDummyEnvironment(); CheckpointExceptionHandlerFactory checkpointExceptionHandlerFactory = new CheckpointExceptionHandlerFactory(); CheckpointExceptionHandler exceptionHandler = checkpointExceptionHandlerFactory.createCheckpointExceptionHandler(false, environment); CheckpointMetaData failedCheckpointMetaData = new CheckpointMetaData(42L, 4711L); Exception testException = new Exception("test"); try { exceptionHandler.tryHandleCheckpointException(failedCheckpointMetaData, testException); } catch (Exception e) { Assert.fail("Exception not handled, but rethrown."); } Assert.assertEquals(failedCheckpointMetaData.getCheckpointId(), environment.getLastDeclinedCheckpointId()); Assert.assertEquals(testException, environment.getLastDeclinedCheckpointCause()); }
@Override public void tryHandleCheckpointException(CheckpointMetaData checkpointMetaData, Exception exception) { try { synchronousCheckpointExceptionHandler.tryHandleCheckpointException(checkpointMetaData, exception); } catch (Exception unhandled) { AsynchronousException asyncException = new AsynchronousException(unhandled); owner.handleAsyncException("Failure in asynchronous checkpoint materialization", asyncException); } } }
@Override public void tryHandleCheckpointException(CheckpointMetaData checkpointMetaData, Exception exception) { try { synchronousCheckpointExceptionHandler.tryHandleCheckpointException(checkpointMetaData, exception); } catch (Exception unhandled) { AsynchronousException asyncException = new AsynchronousException(unhandled); owner.handleAsyncException("Failure in asynchronous checkpoint materialization", asyncException); } } }