当前位置: 首页>>代码示例>>Java>>正文


Java IgniteServices类代码示例

本文整理汇总了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
    ));
}
 
开发者ID:epam,项目名称:Lagerta,代码行数:19,代码来源:SequentialCommitStrategyUnitTest.java

示例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();
    }
}
 
开发者ID:srecon,项目名称:ignite-book-code-samples,代码行数:23,代码来源:TestAsyncMicroServiceMain.java

示例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());
    }
}
 
开发者ID:apache,项目名称:ignite,代码行数:29,代码来源:GridServiceProcessorAbstractSelfTest.java

示例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);
}
 
开发者ID:epam,项目名称:Lagerta,代码行数:9,代码来源:BaseIgniteClusterManager.java

示例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);
}
 
开发者ID:srecon,项目名称:ignite-book-code-samples,代码行数:12,代码来源:ServiceHttpClient.java

示例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);
}
 
开发者ID:apache,项目名称:ignite,代码行数:18,代码来源:AgentClusterDemo.java

示例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;
}
 
开发者ID:apache,项目名称:ignite,代码行数:16,代码来源:PlatformServices.java

示例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;
}
 
开发者ID:apache,项目名称:ignite,代码行数:9,代码来源:VisorCancelServiceTask.java

示例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;
}
 
开发者ID:apache,项目名称:ignite,代码行数:13,代码来源:ClusterGroupAdapter.java

示例10: withAsync

import org.apache.ignite.IgniteServices; //导入依赖的package包/类
/** {@inheritDoc} */
@Override public IgniteServices withAsync() {
    if (isAsync())
        return this;

    return new IgniteServicesImpl(ctx, prj, true);
}
 
开发者ID:apache,项目名称:ignite,代码行数:8,代码来源:IgniteServicesImpl.java

示例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);
        }
    }));
}
 
开发者ID:apache,项目名称:ignite,代码行数:13,代码来源:IgniteServiceConfigVariationsFullApiTest.java

示例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);
        }
    }));
}
 
开发者ID:apache,项目名称:ignite,代码行数:13,代码来源:IgniteServiceConfigVariationsFullApiTest.java

示例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);
            }
        }
    }));
}
 
开发者ID:apache,项目名称:ignite,代码行数:20,代码来源:IgniteServiceConfigVariationsFullApiTest.java

示例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);
        }
    }));
}
 
开发者ID:apache,项目名称:ignite,代码行数:13,代码来源:IgniteServiceConfigVariationsFullApiTest.java

示例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.");
}
 
开发者ID:apache,项目名称:ignite,代码行数:13,代码来源:IgniteChangeGlobalStateTest.java


注:本文中的org.apache.ignite.IgniteServices类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。