本文整理汇总了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()));
}
示例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");
}
示例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);
}