use of com.hazelcast.internal.nio.Connection in project hazelcast by hazelcast.
the class OperationLossTest method when_connectionDroppedWithoutMemberLeaving_then_jobRestarts.
private void when_connectionDroppedWithoutMemberLeaving_then_jobRestarts(boolean useLightJob) {
DAG dag = new DAG();
Vertex source = dag.newVertex("source", () -> new NoOutputSourceP()).localParallelism(1);
Vertex sink = dag.newVertex("sink", DiagnosticProcessors.writeLoggerP());
dag.edge(between(source, sink).distributed());
Job job = useLightJob ? instance().getJet().newLightJob(dag) : instance().getJet().newJob(dag);
assertTrueEventually(() -> assertEquals(2, NoOutputSourceP.initCount.get()));
Connection connection = ImdgUtil.getMemberConnection(getNodeEngineImpl(instance()), getAddress(instances()[1]));
// When
connection.close(null, null);
System.out.println("connection closed");
sleepSeconds(1);
// Then
NoOutputSourceP.proceedLatch.countDown();
if (useLightJob) {
assertThatThrownBy(job::join).hasMessageContaining("The member was reconnected");
} else {
job.join();
assertEquals(4, NoOutputSourceP.initCount.get());
}
}
Aggregations