本文整理汇总了Java中org.apache.ignite.IgniteServices类的典型用法代码示例。如果您正苦于以下问题:Java IgniteServices类的具体用法?Java IgniteServices怎么用?Java IgniteServices使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
IgniteServices类属于org.apache.ignite包,在下文中一共展示了IgniteServices类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initSequentialCommitStrategy
import org.apache.ignite.IgniteServices; //导入依赖的package包/类
@BeforeMethod
public void initSequentialCommitStrategy() {
producer = kafkaMockFactory.producer(null);
KafkaFactory kafkaFactory = mock(KafkaFactory.class);
when(kafkaFactory.producer(any())).thenReturn(producer);
KafkaLogCommitter kafkaLogCommitter = new KafkaLogCommitterImpl(kafkaFactory, localIndexConfig);
statefulCommitter = new StatefulCommitter();
Ignite ignite = mock(Ignite.class);
doReturn(mock(IgniteServices.class)).when(ignite).services();
sequentialCommitStrategy = new SequentialCommitStrategy(new CommitServitor(
serializer,
statefulCommitter,
kafkaLogCommitter,
UUID.randomUUID(),
ignite
));
}
示例2: main
import org.apache.ignite.IgniteServices; //导入依赖的package包/类
public static void main(String[] args) throws JsonProcessingException, InterruptedException {
try (Ignite ignite = Ignition.start(CommonConstants.CLIENT_CONFIG)) {
IgniteCache<AccountCacheKey, AccountCacheData> cache = BankDataGenerator.createBankCache(ignite);
IgniteServices services = ignite.services().withAsync();
services.deployNodeSingleton(AsyncBankService.NAME, new AsyncBankServiceImpl("tcp://localhost:5560"));
services.future().get();
AsyncBankService bankService = services.serviceProxy(AsyncBankService.NAME, AsyncBankService.class, /*not-sticky*/false);
sendAsync(50, BankDataGenerator.TEST_ACCOUNT);
sendAsync(40, BankDataGenerator.TEST_ACCOUNT);
sendAsync(180, BankDataGenerator.TEST_ACCOUNT);
sendAsync(180, BankDataGenerator.TEST_UNKNOWN_ACCOUNT);
services.cancel(AsyncBankService.NAME);
} catch (IOException e) {
e.printStackTrace();
}
}
示例3: testDifferentConfiguration
import org.apache.ignite.IgniteServices; //导入依赖的package包/类
/**
* @throws Exception If failed.
*/
public void testDifferentConfiguration() throws Exception {
String name = "dupService";
IgniteServices svcs1 = randomGrid().services();
IgniteServices svcs2 = randomGrid().services();
IgniteFuture<?> fut1 = svcs1.deployClusterSingletonAsync(name, new DummyService());
IgniteFuture<?> fut2 = svcs2.deployNodeSingletonAsync(name, new DummyService());
info("Deployed service: " + name);
fut1.get();
info("Finished waiting for service future: " + name);
try {
fut2.get();
fail("Failed to receive mismatching configuration exception.");
}
catch (IgniteException e) {
info("Received mismatching configuration exception: " + e.getMessage());
}
}
示例4: startServicesAndCaches
import org.apache.ignite.IgniteServices; //导入依赖的package包/类
protected void startServicesAndCaches() {
clientNode.createCaches(cacheConfigs);
if (serviceConfigs != null) {
IgniteServices services = clientNode.services();
Arrays.stream(serviceConfigs).forEach(services::deploy);
}
Uninterruptibles.sleepUninterruptibly(AWAIT_TIME, TimeUnit.MILLISECONDS);
}
示例5: main
import org.apache.ignite.IgniteServices; //导入依赖的package包/类
public static void main(String[] args) {
URI baseUri = UriBuilder.fromUri("http://localhost/").port(9988).build();
// start the Ignite client
Ignite ignite = Ignition.start(CommonConstants.CLIENT_CONFIG);
IgniteServices services = ignite.services().withAsync();
bankService = services.serviceProxy(BankService.NAME, BankService.class, /*not-sticky*/false);
ResourceConfig config = new ResourceConfig(ServiceHttpClient.class);
HttpServer server = JdkHttpServerFactory.createHttpServer(baseUri, config);
}
示例6: deployServices
import org.apache.ignite.IgniteServices; //导入依赖的package包/类
/**
* Starts read and write from cache in background.
*
* @param services Distributed services on the grid.
*/
private static void deployServices(IgniteServices services) {
services.deployMultiple("Demo service: Multiple instances", new DemoServiceMultipleInstances(), 7, 3);
services.deployNodeSingleton("Demo service: Node singleton", new DemoServiceNodeSingleton());
services.deployClusterSingleton("Demo service: Cluster singleton", new DemoServiceClusterSingleton());
services.deployClusterSingleton("Demo caches load service", new DemoCachesLoadService(20));
services.deployKeyAffinitySingleton("Demo service: Key affinity singleton",
new DemoServiceKeyAffinity(), DemoCachesLoadService.CAR_CACHE_NAME, "id");
services.deployNodeSingleton("RandomCache load service", new DemoRandomCacheLoadService(20));
services.deployMultiple("Demo service: Compute load", new DemoComputeLoadService(), 2, 1);
}
示例7: PlatformServices
import org.apache.ignite.IgniteServices; //导入依赖的package包/类
/**
* Ctor.
*
* @param platformCtx Context.
* @param services Services facade.
* @param srvKeepBinary Server keep binary flag.
*/
public PlatformServices(PlatformContext platformCtx, IgniteServices services, boolean srvKeepBinary) {
super(platformCtx);
assert services != null;
this.services = services;
this.srvKeepBinary = srvKeepBinary;
}
示例8: run
import org.apache.ignite.IgniteServices; //导入依赖的package包/类
/** {@inheritDoc} */
@Override protected Void run(final VisorCancelServiceTaskArg arg) {
IgniteServices services = ignite.services();
services.cancel(arg.getName());
return null;
}
示例9: services
import org.apache.ignite.IgniteServices; //导入依赖的package包/类
/**
* @return {@link IgniteServices} for this cluster group.
*/
public IgniteServices services() {
if (svcs == null) {
assert ctx != null;
svcs = new IgniteServicesImpl(ctx, this, false);
}
return svcs;
}
示例10: withAsync
import org.apache.ignite.IgniteServices; //导入依赖的package包/类
/** {@inheritDoc} */
@Override public IgniteServices withAsync() {
if (isAsync())
return this;
return new IgniteServicesImpl(ctx, prj, true);
}
示例11: testNodeSingletonDeploy
import org.apache.ignite.IgniteServices; //导入依赖的package包/类
/**
* Test node singleton deployment
*
* @throws Exception If failed.
*/
public void testNodeSingletonDeploy() throws Exception {
runInAllDataModes(new ServiceTestRunnable(true, new DeployClosure() {
@Override public void run(IgniteServices services, String svcName, TestService svc) {
services.deployNodeSingleton(svcName, (Service)svc);
}
}));
}
示例12: testClusterSingletonDeploy
import org.apache.ignite.IgniteServices; //导入依赖的package包/类
/**
* Test cluster singleton deployment
*
* @throws Exception If failed.
*/
public void testClusterSingletonDeploy() throws Exception {
runInAllDataModes(new ServiceTestRunnable(false, new DeployClosure() {
@Override public void run(IgniteServices services, String svcName, TestService svc) {
services.deployClusterSingleton(svcName, (Service)svc);
}
}));
}
示例13: testKeyAffinityDeploy
import org.apache.ignite.IgniteServices; //导入依赖的package包/类
/**
* Test key affinity deployment
*
* @throws Exception If failed.
*/
public void testKeyAffinityDeploy() throws Exception {
runInAllDataModes(new ServiceTestRunnable(false, new DeployClosure() {
@Override public void run(IgniteServices services, String svcName, TestService svc) {
IgniteCache<Object, Object> cache = grid(testedNodeIdx).getOrCreateCache(CACHE_NAME);
try {
services.deployKeyAffinitySingleton(svcName, (Service)svc, cache.getName(), primaryKey(cache));
}
catch (IgniteCheckedException e) {
throw new IgniteException(e);
}
}
}));
}
示例14: testMultipleDeploy
import org.apache.ignite.IgniteServices; //导入依赖的package包/类
/**
* Tests multiple deployment
*
* @throws Exception If failed.
*/
public void testMultipleDeploy() throws Exception {
runInAllDataModes(new ServiceTestRunnable(true, new DeployClosure() {
@Override public void run(IgniteServices services, String svcName, TestService svc) {
services.deployMultiple(svcName, (Service)svc, 0, 1);
}
}));
}
示例15: checkExceptionTryUseService
import org.apache.ignite.IgniteServices; //导入依赖的package包/类
/**
* @param ig Node to check.
*/
private void checkExceptionTryUseService(final Ignite ig) {
assertThrows(log, new Callable<Void>() {
@Override public Void call() throws Exception {
IgniteServices srvs = ig.services();
return null;
}
}, IgniteException.class, "Can not perform the operation because the cluster is inactive.");
}