use of org.apache.ignite.spi.systemview.view.ServiceView in project ignite by apache.
the class KillCommandsTests method doTestCancelService.
/**
* Test cancel of the service.
*
* @param startCli Client node to start service.
* @param killCli Client node to kill service.
* @param srv Server node.
* @param svcCanceler Service cancel closure.
*/
public static void doTestCancelService(IgniteEx startCli, IgniteEx killCli, IgniteEx srv, Consumer<String> svcCanceler) throws Exception {
ServiceConfiguration scfg = new ServiceConfiguration();
scfg.setName(SVC_NAME);
scfg.setMaxPerNodeCount(1);
scfg.setNodeFilter(srv.cluster().predicate());
scfg.setService(new TestServiceImpl());
startCli.services().deploy(scfg);
SystemView<ServiceView> svcView = srv.context().systemView().view(SVCS_VIEW);
SystemView<ServiceView> killCliSvcView = killCli.context().systemView().view(SVCS_VIEW);
boolean res = waitForCondition(() -> svcView.size() == 1 && killCliSvcView.size() == 1, TIMEOUT);
assertTrue(res);
TestService svc = startCli.services().serviceProxy(SVC_NAME, TestService.class, true);
assertNotNull(svc);
svcCanceler.accept(SVC_NAME);
res = waitForCondition(() -> svcView.size() == 0, TIMEOUT);
assertTrue(res);
}
Aggregations