use of com.alibaba.otter.shared.arbitrate.impl.setl.monitor.TerminMonitor in project otter by alibaba.
the class TerminMonitorTest method test_dynamic.
@Test
public void test_dynamic() {
initTermin(1L);
initTermin(2L);
try {
terminMonitor = new TerminMonitor(pipelineId);
// 开始变化
destoryTermin(1L);
initTermin(3L);
initTermin(1L);
sleep();
Long p1 = terminMonitor.waitForProcess();
terminMonitor.ack(p1);
Long p2 = terminMonitor.waitForProcess();
terminMonitor.ack(p2);
Long p3 = terminMonitor.waitForProcess();
terminMonitor.ack(p3);
// 一定是按顺序输出
want.bool(p1.equals(1L)).is(true);
want.bool(p2.equals(2L)).is(true);
want.bool(p3.equals(3L)).is(true);
terminMonitor.destory();
} catch (InterruptedException e) {
want.fail();
} finally {
destoryTermin(1L);
destoryTermin(2L);
destoryTermin(3L);
}
}
Aggregations