本文整理汇总了Java中com.hazelcast.client.config.ClientNetworkConfig类的典型用法代码示例。如果您正苦于以下问题:Java ClientNetworkConfig类的具体用法?Java ClientNetworkConfig怎么用?Java ClientNetworkConfig使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ClientNetworkConfig类属于com.hazelcast.client.config包,在下文中一共展示了ClientNetworkConfig类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: init
import com.hazelcast.client.config.ClientNetworkConfig; //导入依赖的package包/类
/**
* Service INIT
*/
public void init() {
String clientServers = serverConfigurationService.getString("memory.hc.server", null);
boolean clientConfigured = StringUtils.isNotBlank(clientServers);
if (clientConfigured) {
ClientConfig clientConfig = new ClientConfig();
ClientNetworkConfig clientNetworkConfig = new ClientNetworkConfig();
clientNetworkConfig.addAddress(StringUtils.split(clientServers, ','));
clientConfig.setNetworkConfig(clientNetworkConfig);
hcInstance = HazelcastClient.newHazelcastClient(clientConfig);
} else {
// start up a local server instead
Config localConfig = new Config();
localConfig.setInstanceName(serverConfigurationService.getServerIdInstance());
hcInstance = Hazelcast.newHazelcastInstance(localConfig);
}
if (hcInstance == null) {
throw new IllegalStateException("init(): HazelcastInstance is null!");
}
log.info("INIT: " + hcInstance.getName() + " ("+(clientConfigured?"client:"+hcInstance.getClientService():"localServer")+"), cache maps: " + hcInstance.getDistributedObjects());
}
开发者ID:sakaiproject,项目名称:sakai,代码行数:24,代码来源:HazelcastMemoryService.java
示例2: init
import com.hazelcast.client.config.ClientNetworkConfig; //导入依赖的package包/类
@Override
public boolean init( StepMetaInterface smi, StepDataInterface sdi ) {
if ( super.init( smi, sdi ) ) {
try {
// Create client and connect to Hazelcast server(s)
Set<InetSocketAddress> servers = ( (HazelcastOutputMeta) smi ).getServers();
ClientConfig clientConfig = new ClientConfig();
ClientNetworkConfig clientNetConfig = new ClientNetworkConfig();
if ( servers != null ) {
for ( InetSocketAddress server : servers ) {
clientNetConfig.addAddress( server.getHostName() + ":" + server.getPort() );
}
clientConfig.setNetworkConfig( clientNetConfig );
client = HazelcastClient.newHazelcastClient( clientConfig );
}
return true;
} catch ( Exception e ) {
logError( BaseMessages.getString( PKG, "HazelcastOutput.Error.ConnectError" ), e );
return false;
}
} else {
return false;
}
}
开发者ID:mattyb149,项目名称:pdi-hazelcast-plugin,代码行数:26,代码来源:HazelcastOutput.java
示例3: init
import com.hazelcast.client.config.ClientNetworkConfig; //导入依赖的package包/类
@Override
public boolean init( StepMetaInterface smi, StepDataInterface sdi ) {
if ( super.init( smi, sdi ) ) {
try {
// Create client and connect to Hazelcast server(s)
Set<InetSocketAddress> servers = ( (HazelcastInputMeta) smi ).getServers();
ClientConfig clientConfig = new ClientConfig();
ClientNetworkConfig clientNetConfig = new ClientNetworkConfig();
if ( servers != null ) {
for ( InetSocketAddress server : servers ) {
clientNetConfig.addAddress( server.getHostName() + ":" + server.getPort() );
}
clientConfig.setNetworkConfig( clientNetConfig );
client = HazelcastClient.newHazelcastClient( clientConfig );
}
return true;
} catch ( Exception e ) {
logError( BaseMessages.getString( PKG, "HazelcastInput.Error.ConnectError" ), e );
return false;
}
} else {
return false;
}
}
开发者ID:mattyb149,项目名称:pdi-hazelcast-plugin,代码行数:26,代码来源:HazelcastInput.java
示例4: createInstanceClient
import com.hazelcast.client.config.ClientNetworkConfig; //导入依赖的package包/类
private static HazelcastInstance createInstanceClient()
{
final ClientNetworkConfig networkConfig = new ClientNetworkConfig();
networkConfig.addAddress("192.168.172.235");
final ClientConfig clientConfig = new ClientConfig();
clientConfig.setNetworkConfig(networkConfig);
return HazelcastClient.newHazelcastClient(clientConfig);
}
开发者ID:mraad,项目名称:HZSpatial,代码行数:11,代码来源:Main.java
示例5: initialize
import com.hazelcast.client.config.ClientNetworkConfig; //导入依赖的package包/类
@Override
public void initialize(ClassLoadHelper loadHelper, SchedulerSignaler signaler)
throws SchedulerConfigException {
log.info("Initializing HazelcastJobStore..");
final ClientConfig clientConfig = new ClientConfig();
final ClientNetworkConfig networkConfig = clientConfig.getNetworkConfig();
networkConfig.addAddress("127.0.0.1:5701");
hazelcastClient = HazelcastClient.newHazelcastClient(clientConfig);
// initializing hazelcast maps
jobsByKey = hazelcastClient.getMap(HC_JOB_STORE_MAP_JOB);
triggersByKey = hazelcastClient.getMap(HC_JOB_STORE_TRIGGER_BY_KEY_MAP);
jobsByGroup = hazelcastClient
.getMultiMap(HC_JOB_STORE_MAP_JOB_BY_GROUP_MAP);
triggersByGroup = hazelcastClient
.getMultiMap(HC_JOB_STORE_TRIGGER_KEY_BY_GROUP_MAP);
pausedTriggerGroups = hazelcastClient
.getSet(HC_JOB_STORE_PAUSED_TRIGGER_GROUPS);
pausedJobGroups = hazelcastClient.getSet(HC_JOB_STORE_PAUSED_JOB_GROUPS);
calendarsByName = hazelcastClient.getMap(HC_JOB_CALENDAR_MAP);
this.schedSignaler = signaler;
triggersByKey.addIndex("nextFireTime", true);
log.info("HazelcastJobStore Initialized.");
}
开发者ID:Ameausoone,项目名称:quartz-hazelcast-jobstore,代码行数:29,代码来源:HazelcastJobStore.java
示例6: hazelcastInstance
import com.hazelcast.client.config.ClientNetworkConfig; //导入依赖的package包/类
@Bean
public HazelcastInstance hazelcastInstance() {
ClientNetworkConfig networkConfig = new ClientNetworkConfig()
.addAddress("localhost");
ClientConfig clientConfig = new ClientConfig();
clientConfig.setNetworkConfig(networkConfig);
return HazelcastClient.newHazelcastClient(clientConfig);
}
开发者ID:hantsy,项目名称:spring4-sandbox,代码行数:9,代码来源:HazelcastCacheConfig.java
注:本文中的com.hazelcast.client.config.ClientNetworkConfig类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论