本文整理匯總了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);
}