Search in sources :

Example 31 with TerminEventData

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);
    }
}
Also used : TerminEventData(com.alibaba.otter.shared.arbitrate.model.TerminEventData)

Example 32 with TerminEventData

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);
}
Also used : TerminEventData(com.alibaba.otter.shared.arbitrate.model.TerminEventData) PermitMonitor(com.alibaba.otter.shared.arbitrate.impl.setl.monitor.PermitMonitor) Test(org.testng.annotations.Test) BaseArbitrateEventTest(com.alibaba.otter.shared.arbitrate.setl.event.BaseArbitrateEventTest)

Aggregations

TerminEventData (com.alibaba.otter.shared.arbitrate.model.TerminEventData)32 Test (org.testng.annotations.Test)12 PermitMonitor (com.alibaba.otter.shared.arbitrate.impl.setl.monitor.PermitMonitor)9 BaseArbitrateEventTest (com.alibaba.otter.shared.arbitrate.setl.event.BaseArbitrateEventTest)9 ArrayList (java.util.ArrayList)7 EtlEventData (com.alibaba.otter.shared.arbitrate.model.EtlEventData)6 Mock (mockit.Mock)5 BaseEventTest (com.alibaba.otter.shared.arbitrate.BaseEventTest)3 ArbitrateException (com.alibaba.otter.shared.arbitrate.exception.ArbitrateException)3 Date (java.util.Date)3 ExtractMemoryArbitrateEvent (com.alibaba.otter.shared.arbitrate.impl.setl.memory.ExtractMemoryArbitrateEvent)2 LoadMemoryArbitrateEvent (com.alibaba.otter.shared.arbitrate.impl.setl.memory.LoadMemoryArbitrateEvent)2 SelectMemoryArbitrateEvent (com.alibaba.otter.shared.arbitrate.impl.setl.memory.SelectMemoryArbitrateEvent)2 TransformMemoryArbitrateEvent (com.alibaba.otter.shared.arbitrate.impl.setl.memory.TransformMemoryArbitrateEvent)2 ExtractZooKeeperArbitrateEvent (com.alibaba.otter.shared.arbitrate.impl.setl.zookeeper.ExtractZooKeeperArbitrateEvent)2 LoadZooKeeperArbitrateEvent (com.alibaba.otter.shared.arbitrate.impl.setl.zookeeper.LoadZooKeeperArbitrateEvent)2 SelectZooKeeperArbitrateEvent (com.alibaba.otter.shared.arbitrate.impl.setl.zookeeper.SelectZooKeeperArbitrateEvent)2 TransformZooKeeperArbitrateEvent (com.alibaba.otter.shared.arbitrate.impl.setl.zookeeper.TransformZooKeeperArbitrateEvent)2 IOException (java.io.IOException)2 SelectException (com.alibaba.otter.node.etl.select.exceptions.SelectException)1