use of org.apache.flink.core.execution.JobListener in project flink by apache.
the class JobListenerITCase method testExecuteAsyncCallsJobListenerOnMainThreadOnStreamEnvironment.
@Test
public void testExecuteAsyncCallsJobListenerOnMainThreadOnStreamEnvironment() throws Exception {
AtomicReference<Thread> threadReference = new AtomicReference<>();
StreamExecutionEnvironment env = new StreamExecutionEnvironment(getClientConfiguration());
env.registerJobListener(new JobListener() {
@Override
public void onJobSubmitted(JobClient jobClient, Throwable t) {
threadReference.set(Thread.currentThread());
}
@Override
public void onJobExecuted(JobExecutionResult jobExecutionResult, Throwable throwable) {
}
});
env.fromElements(1, 2, 3, 4, 5).addSink(new DiscardingSink<>());
env.executeAsync();
assertThat(Thread.currentThread(), is(threadReference.get()));
}
Aggregations