use of com.alibaba.otter.shared.arbitrate.impl.setl.monitor.MainstemMonitor in project otter by alibaba.
the class MainStemMonitorTest method testRelease.
@Test
public void testRelease() {
MainstemMonitor mainstemMonitor = ArbitrateFactory.getInstance(pipelineId, MainstemMonitor.class);
boolean running = mainstemMonitor.check();
want.bool(running).is(true);
// 模拟一次断网,
boolean release = mainstemMonitor.releaseMainstem();
want.bool(release).is(true);
long start = System.currentTimeMillis();
try {
mainstemMonitor.waitForActive();
} catch (InterruptedException e) {
want.fail();
}
want.number(System.currentTimeMillis() - start).isLe(1000L);
ArbitrateFactory.destory(pipelineId);
mainstemMonitor.releaseMainstem();
}
Aggregations