本文整理了Java中org.apache.ignite.Ignite.services()
方法的一些代码示例,展示了Ignite.services()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Ignite.services()
方法的具体详情如下:
包路径:org.apache.ignite.Ignite
类名称:Ignite
方法名:services
[英]Gets services facade over all cluster nodes started in server mode.
[中]获取在服务器模式下启动的所有群集节点上的服务外观。
代码示例来源:origin: apache/ignite
/** {@inheritDoc} */
@Override public IgniteServices services() {
checkIgnite();
return g.services();
}
代码示例来源:origin: apache/ignite
@Override public Void call() throws Exception {
IgniteServices srvs = ig.services();
return null;
}
}, IgniteException.class, "Can not perform the operation because the cluster is inactive.");
代码示例来源:origin: apache/ignite
/**
* Stops Apache Ignite services that represent distributed inference infrastructure.
*/
private void stopService() {
ignite.services().cancel(String.format(INFERENCE_SERVICE_NAME_PATTERN, suffix));
}
代码示例来源:origin: apache/ignite
/** {@inheritDoc} */
@Override public IgniteServices services(ClusterGroup grp) {
checkIgnite();
return g.services(grp);
}
代码示例来源:origin: apache/ignite
/**
* Stops TensorFlow cluster.
*
* @param clusterId Cluster identifier.
*/
public void stopClusterIfExists(UUID clusterId) {
ignite.services().cancel(String.format(SERVICE_NAME_TEMPLATE, clusterId));
log.info("Cluster maintained cancelled as a service [clusterId=" + clusterId + "]");
}
代码示例来源:origin: apache/ignite
@Override public Object call() throws Exception {
System.out.println("Undeploy " + SERVICE_NAME);
ignite.services().cancel(SERVICE_NAME);
return null;
}
});
代码示例来源:origin: apache/ignite
/** {@inheritDoc} */
@Override public Boolean call() throws Exception {
try {
return ignite.services().serviceDescriptors().iterator().hasNext();
} catch (Exception e) {
e.printStackTrace();
return false;
} finally {
Thread.sleep(10);
}
}
}
代码示例来源:origin: apache/ignite
/**
* @param node Node.
* @return Service proxy.
*/
private static MyService serviceProxy(Ignite node) {
return node.services().serviceProxy("DummyService", MyService.class, true);
}
代码示例来源:origin: apache/ignite
/**
* @throws Exception If failed.
*/
private CounterService proxy(Ignite g) throws Exception {
return g.services().serviceProxy(SERVICE_NAME, CounterService.class, false);
}
代码示例来源:origin: apache/ignite
@Override public boolean apply() {
return ignite.services(grp).serviceDescriptors().size() == 1;
}
}, 5000);
代码示例来源:origin: apache/ignite
@Override public boolean apply() {
TestService srvc = grid(srvcNode).services().service(srvcName);
if (srvc == null)
return false;
assertEquals(srvcNode, srvc.serviceNode());
return true;
}
}, 5000);
代码示例来源:origin: apache/ignite
/** {@inheritDoc} */
@Override public void inject(GridResourceField field, Object target, Class<?> depCls, GridDeployment dep)
throws IgniteCheckedException {
ServiceResource ann = (ServiceResource)field.getAnnotation();
Class svcItf = ann.proxyInterface();
Object svc;
if (svcItf == Void.class)
svc = ignite.services().service(ann.serviceName());
else
svc = ignite.services().serviceProxy(ann.serviceName(), svcItf, ann.proxySticky());
if (svc != null)
GridResourceUtils.inject(field.getField(), target, svc);
}
代码示例来源:origin: apache/ignite
/** {@inheritDoc} */
@Override public Object execute() throws IgniteException {
ignite.services().deployNodeSingleton(serviceName, new PlatformTestService());
return null;
}
}
代码示例来源:origin: apache/ignite
/**
* @param client Client Ignite instance.
* @param expCfgs Configurations of services that are expected to be deployed.
*/
private void assertDeployedServices(Ignite client, Collection<ServiceConfiguration> expCfgs) {
Set<String> expNames = new HashSet<>();
Set<String> actNames = new HashSet<>();
for (ServiceConfiguration cfg : expCfgs)
expNames.add(cfg.getName());
for (ServiceDescriptor desc : client.services().serviceDescriptors())
actNames.add(desc.name());
assertEquals(expNames, actNames);
}
代码示例来源:origin: apache/ignite
/**
* @throws Exception If failed.
*/
@Test
public void testExecution() throws Exception {
startGrid(0); // Server.
Ignition.setClientMode(true);
Ignite ignite = startGrid(); // Client.
ignite.services().deployClusterSingleton("my-service", new MyServiceImpl());
MyService svc = ignite.services().serviceProxy("my-service", MyService.class, false);
svc.hello();
}
代码示例来源:origin: apache/ignite
/**
* @param client Client node.
* @param svcName Service name.
* @throws Exception If failed.
*/
private void checkDeploy(Ignite client, String svcName) throws Exception {
assertTrue(client.configuration().isClientMode());
CountDownLatch latch = new CountDownLatch(1);
DummyService.exeLatch(svcName, latch);
client.services().deployClusterSingleton(svcName, new DummyService());
assertTrue(latch.await(5000, TimeUnit.MILLISECONDS));
}
}
代码示例来源:origin: apache/ignite
/**
* @throws Exception If failed.
*/
@Test
public void testDeployAll() throws Exception {
Ignite client = grid(CLIENT_NODE_NAME);
CountDownLatch latch = new CountDownLatch(NUM_SERVICES);
List<ServiceConfiguration> cfgs = getConfigs(client.cluster().forServers().predicate(), NUM_SERVICES);
subscribeExeLatch(cfgs, latch);
client.services().deployAll(cfgs);
assertTrue("Waiting for services deployment timed out.", latch.await(30, TimeUnit.SECONDS));
assertDeployedServices(client, cfgs);
}
代码示例来源:origin: apache/ignite
/**
* @throws Exception If failed.
*/
@Test
public void testServiceDeployment1() throws Exception {
startGrid(SERVER_NODE);
startGrid(SERVER_NODE_WITH_EXT_CLASS_LOADER).services().deploy(serviceConfig());
startGrid(CLIENT_NODE);
startGrid(CLIENT_NODE_WITH_EXT_CLASS_LOADER).services().deploy(serviceConfig());
ignite(SERVER_NODE).services().serviceDescriptors();
ignite(SERVER_NODE_WITH_EXT_CLASS_LOADER).services().serviceDescriptors();
}
代码示例来源:origin: apache/ignite
/**
* @param ignite Ignite.
*/
private void deployService(final Ignite ignite) {
ServiceConfiguration svcCfg = new ServiceConfiguration();
svcCfg.setService(new ManagementService());
svcCfg.setName(SERVICE_NAME);
svcCfg.setTotalCount(1);
svcCfg.setMaxPerNodeCount(1);
svcCfg.setNodeFilter((IgnitePredicate<ClusterNode>)node -> !node.isClient());
ignite.services().deploy(svcCfg);
}
代码示例来源:origin: apache/ignite
/**
* @throws Exception If failed.
*/
@Test
public void testServiceDeployment3() throws Exception {
startGrid(0).services().deploy(serviceConfig(true));
startGrid(1);
startGrid(2);
stopGrid(0);
awaitPartitionMapExchange();
ignite(1).services().deploy(serviceConfig(false));
startGrid(0);
}
内容来源于网络,如有侵权,请联系作者删除!