本文整理汇总了Java中com.hazelcast.client.config.ClientConfig.setProperty方法的典型用法代码示例。如果您正苦于以下问题:Java ClientConfig.setProperty方法的具体用法?Java ClientConfig.setProperty怎么用?Java ClientConfig.setProperty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.hazelcast.client.config.ClientConfig
的用法示例。
在下文中一共展示了ClientConfig.setProperty方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: HcConnectionStore
import com.hazelcast.client.config.ClientConfig; //导入方法依赖的package包/类
public HcConnectionStore(final String connectionString, final String groupName, final String mapName, final String host) {
final ClientConfig clientConfig = new ClientConfig();
clientConfig.setProperty("hazelcast.logging.type", "slf4j");
clientConfig.getNetworkConfig().setAddresses(LangUtil.splitCsStrings(Preconditions.checkNotNull(connectionString)));
clientConfig.getGroupConfig().setName(Preconditions.checkNotNull(groupName));
this.hazelcastClient = HazelcastClient.newHazelcastClient(clientConfig);
this.mapName = Preconditions.checkNotNull(mapName);
this.host = Preconditions.checkNotNull(host);
}
示例2: createClientConfig
import com.hazelcast.client.config.ClientConfig; //导入方法依赖的package包/类
private ClientConfig createClientConfig(String zookeeperURL) {
DiscoveryStrategyConfig discoveryStrategyConfig = createDiscoveryConfig(zookeeperURL);
ClientConfig clientConfig = new ClientConfig();
clientConfig.setProperty("hazelcast.discovery.enabled", "true");
clientConfig.getNetworkConfig().getDiscoveryConfig().addDiscoveryStrategyConfig(discoveryStrategyConfig);
return clientConfig;
}
示例3: getHazelcastInstance
import com.hazelcast.client.config.ClientConfig; //导入方法依赖的package包/类
public synchronized HazelcastInstance getHazelcastInstance(HazelcastConfig configuration) {
if (hazelcastInstance == null) {
final String serverName = configuration.getServerName();
final String serverPort = configuration.getServerPort();
final String groupName = configuration.getGroupName();
LOG.debug("Hazelcast server name: {}", serverName);
LOG.debug("Hazelcast server port: {}", serverPort);
LOG.debug("Hazelcast group name: {}", groupName);
final ClientConfig clientConfig = new ClientConfig();
clientConfig.getNetworkConfig().setConnectionAttemptLimit(configuration.getConnectionAttemptLimit());
clientConfig.getNetworkConfig().setConnectionAttemptPeriod(configuration.getConnectionAttemptPeriod());
clientConfig.getNetworkConfig().setConnectionTimeout(configuration.getConnectionTimeout());
clientConfig.getNetworkConfig().addAddress(serverName + ":" + serverPort);
clientConfig.getGroupConfig().setName(groupName);
clientConfig.setProperty(LOGGER_PROPERTY_NAME, LOGGER_PROPERTY_SLF4J_TYPE);
final SerializerConfig dolphinEventSerializerConfig = new SerializerConfig().
setImplementation(new EventStreamSerializer()).setTypeClass(DolphinEvent.class);
clientConfig.getSerializationConfig().getSerializerConfigs().add(dolphinEventSerializerConfig);
hazelcastInstance = HazelcastClient.newHazelcastClient(clientConfig);
}
return hazelcastInstance;
}
示例4: beforeClass
import com.hazelcast.client.config.ClientConfig; //导入方法依赖的package包/类
@BeforeClass
public static void beforeClass() {
Config config = new Config();
config.setProperty("hazelcast.partition.count", "" + PARTITION_COUNT);
hz = newHazelcastInstance(config);
HazelcastInstance remoteInstance = newHazelcastInstance(config);
warmupPartitions(hz);
warmupPartitions(remoteInstance);
ClientConfig clientconfig = new ClientConfig();
clientconfig.setProperty("hazelcast.partition.count", "" + PARTITION_COUNT);
client = HazelcastClient.newHazelcastClient(clientconfig);
}
示例5: hazelcast
import com.hazelcast.client.config.ClientConfig; //导入方法依赖的package包/类
@Bean
public HazelcastInstance hazelcast() throws Exception {
ClientConfig clientConfig = new ClientConfig();
clientConfig.getGroupConfig()
.setName(groupName)
.setPassword(groupPassword);
clientConfig.getNetworkConfig()
.setAddresses(clusterMembers);
clientConfig.getSerializationConfig()
.addPortableFactory(1, new DevicePortableFactory());
clientConfig.setProperty("hazelcast.client.event.thread.count", eventThreadCount);
return HazelcastClient.newHazelcastClient(clientConfig);
}