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


Java ServiceConfig类代码示例

本文整理汇总了Java中com.hazelcast.config.ServiceConfig的典型用法代码示例。如果您正苦于以下问题:Java ServiceConfig类的具体用法?Java ServiceConfig怎么用?Java ServiceConfig使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ServiceConfig类属于com.hazelcast.config包,在下文中一共展示了ServiceConfig类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: configureJetService

import com.hazelcast.config.ServiceConfig; //导入依赖的package包/类
static void configureJetService(JetConfig jetConfig) {
    if (!(jetConfig.getHazelcastConfig().getConfigPatternMatcher() instanceof MatchingPointConfigPatternMatcher)) {
        throw new UnsupportedOperationException("Custom config pattern matcher is not supported in Jet");
    }

    jetConfig.getHazelcastConfig().getServicesConfig()
             .addServiceConfig(new ServiceConfig().setEnabled(true)
                                                  .setName(JetService.SERVICE_NAME)
                                                  .setClassName(JetService.class.getName())
                                                  .setConfigObject(jetConfig));

    jetConfig.getHazelcastConfig().addMapConfig(new MapConfig(INTERNAL_JET_OBJECTS_PREFIX + "*")
             .setBackupCount(jetConfig.getInstanceConfig().getBackupCount())
             .setStatisticsEnabled(false)
             .setMergePolicy(IgnoreMergingEntryMapMergePolicy.class.getName()));
}
 
开发者ID:hazelcast,项目名称:hazelcast-jet,代码行数:17,代码来源:Jet.java

示例2: main

import com.hazelcast.config.ServiceConfig; //导入依赖的package包/类
public static void main(String[] args) {

        final ServiceConfig serviceConfig = new ServiceConfig();
        serviceConfig.setEnabled(true);
        serviceConfig.setClassName(LocalCacheService.class.getName());
        serviceConfig.setName(LocalCacheService.SERVICE_NAME);

        final Config config = new Config();
        final ServicesConfig servicesConfig = config.getServicesConfig();
        servicesConfig.addServiceConfig(serviceConfig);

        final HazelcastInstance instance = Hazelcast.newHazelcastInstance(config);
        IMap localCache = instance.getDistributedObject(LocalCacheService.SERVICE_NAME, "foo");


        System.err.println("lc: " + localCache);

//        ClientConfig clientConfig = new ClientConfig();
//        ProxyFactoryConfig proxyFactoryConfig = new ProxyFactoryConfig();
//        proxyFactoryConfig.setClassName(ProxyFactory.class.getName());
//        proxyFactoryConfig.setService(LocalCacheService.SERVICE_NAME);
//        clientConfig.addProxyFactoryConfig(proxyFactoryConfig);
//
//        HazelcastInstance client = HazelcastClient.newHazelcastClient(clientConfig);
//
//        IQueue clientQ = client.getDistributedObject(LocalCacheService.SERVICE_NAME, "foo");

    }
 
开发者ID:gurbuzali,项目名称:hazel-local-cache,代码行数:29,代码来源:MainTest.java

示例3: main

import com.hazelcast.config.ServiceConfig; //导入依赖的package包/类
public static void main(String[] args) throws Exception {
        final ServiceConfig serviceConfig = new ServiceConfig();
        serviceConfig.setEnabled(true);
        serviceConfig.setClassName(ScheduledExecutorService.class.getName());
        serviceConfig.setName(ScheduledExecutorService.SERVICE_NAME);
        final Config config = new Config();
        final ServicesConfig servicesConfig = config.getServicesConfig();
        servicesConfig.addServiceConfig(serviceConfig);
        SerializationConfig memberSerializationConfig = config.getSerializationConfig();
//        PriorityPortableHook hook = new PriorityPortableHook();
//        memberSerializationConfig.addPortableFactory(PriorityPortableHook.F_ID, hook.createFactory());
        final HazelcastInstance instance = Hazelcast.newHazelcastInstance(config);
        IScheduledExecutorService scheduled = instance.getDistributedObject(ScheduledExecutorService.SERVICE_NAME, "foo");
        ScheduledFuture future = scheduled.scheduleAtFixedRate(new MyCallable(), 5, 5, TimeUnit.SECONDS);

        Thread.sleep(23000);

//        ClientConfig clientConfig = new ClientConfig();
//        ProxyFactoryConfig proxyFactoryConfig = new ProxyFactoryConfig();
////        proxyFactoryConfig.setClassName(ProxyFactory.class.getName());
////        proxyFactoryConfig.setService(ScheduledExecutorService.SERVICE_NAME);
//        clientConfig.addProxyFactoryConfig(proxyFactoryConfig);
//        SerializationConfig clientSerializationConfig = clientConfig.getSerializationConfig();
////        clientSerializationConfig.addPortableFactory(PriorityPortableHook.F_ID, hook.createFactory());
//        HazelcastInstance client = HazelcastClient.newHazelcastClient(clientConfig);
//        IQueue clientQ = client.getDistributedObject(ScheduledExecutorService.SERVICE_NAME, "foo");
//        clientQ.offer("veli");
//        clientQ.offer("ali");
//        Object ali = memberQ.poll();
//        Object veli = memberQ.poll();
//        System.err.println("ali: " + ali);
//        System.err.println("veli: " + veli);
    }
 
开发者ID:gurbuzali,项目名称:scheduled-executor,代码行数:34,代码来源:MainTest.java


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