use of com.alibaba.otter.shared.arbitrate.model.TerminEventData in project otter by alibaba.
the class TerminArbitrateEventTest method destoryTermin.
private void destoryTermin() {
String path = StagePathUtils.getTerminRoot(pipelineId);
List<String> terminNodes = zookeeper.getChildren(path);
for (String node : terminNodes) {
// 删除对应的错误节点
TerminEventData termin = new TerminEventData();
termin.setPipelineId(pipelineId);
termin.setProcessId(StagePathUtils.getProcessId(node));
System.out.println("remove termin node: " + path + "/" + node);
// 发送ack信号,删除termin节点
terminEvent.ack(termin);
}
}
use of com.alibaba.otter.shared.arbitrate.model.TerminEventData in project otter by alibaba.
the class TerminArbitrateEventTest method test_Restart.
@Test
public void test_Restart() {
normalProcess();
// 发送restart信号
TerminEventData rollback = new TerminEventData();
rollback.setPipelineId(pipelineId);
rollback.setType(TerminType.RESTART);
terminEvent.single(rollback);
PermitMonitor monitor = ArbitrateFactory.getInstance(pipelineId, PermitMonitor.class);
sleep(4000L);
want.bool(monitor.getChannelPermit().isStart()).is(true);
// 发送shutdown信号
TerminEventData shutdown = new TerminEventData();
shutdown.setPipelineId(pipelineId);
shutdown.setType(TerminType.SHUTDOWN);
terminEvent.single(shutdown);
want.bool(monitor.getChannelPermit().isStop()).is(true);
// 删除对应的错误节点
destoryTermin();
ArbitrateFactory.destory(pipelineId);
}
Aggregations