本文整理汇总了Java中com.hazelcast.client.config.XmlClientConfigBuilder类的典型用法代码示例。如果您正苦于以下问题:Java XmlClientConfigBuilder类的具体用法?Java XmlClientConfigBuilder怎么用?Java XmlClientConfigBuilder使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
XmlClientConfigBuilder类属于com.hazelcast.client.config包,在下文中一共展示了XmlClientConfigBuilder类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: lifecycleEvent
import com.hazelcast.client.config.XmlClientConfigBuilder; //导入依赖的package包/类
@Override
public void lifecycleEvent(LifecycleEvent event) {
if (getConfigLocation() == null) {
setConfigLocation("hazelcast-client-default.xml");
}
if ("start".equals(event.getType())) {
try {
XmlClientConfigBuilder builder = new XmlClientConfigBuilder(getConfigLocation());
config = builder.build();
} catch (IOException e) {
throw new RuntimeException("failed to load Config:", e);
}
if (config == null) {
throw new RuntimeException("failed to find configLocation:" + getConfigLocation());
}
}
}
开发者ID:hazelcast,项目名称:hazelcast-tomcat-sessionmanager,代码行数:22,代码来源:ClientServerLifecycleListener.java
示例2: perform
import com.hazelcast.client.config.XmlClientConfigBuilder; //导入依赖的package包/类
/**
* Wait till master node prepare configuration for sending, then create it's own sender and starts document insertion.
*/
@Override
public void perform(DefaultProperties properties) throws IOException {
ClientConfig config = new XmlClientConfigBuilder("hazelcast/hazelcast-slave.xml").build();
String[] masterAddresses = properties.getProperty(ClusterConstants.CLUSTER_MASTER_PROP).split(",");
config.getNetworkConfig().addAddress(masterAddresses);
HazelcastInstance client = HazelcastClient.newHazelcastClient(config);
try {
init(client, properties);
} catch (InterruptedException ex) {
LOGGER.error("Thread interrupted: ", ex);
} finally {
client.shutdown();
}
}
示例3: initClient
import com.hazelcast.client.config.XmlClientConfigBuilder; //导入依赖的package包/类
@BeforeClass
public static void initClient() throws Exception {
ClientConfig cc = new XmlClientConfigBuilder("hazelcast-client.xml").build();
cc.getNetworkConfig().addAddress(hazelcast.getContainerIpAddress() + ":" + hazelcast.getFirstMappedPort());
hazelcastClient = HazelcastClient.newHazelcastClient(cc);
supplements = hazelcastClient.getMap("supplements");
}
示例4: main
import com.hazelcast.client.config.XmlClientConfigBuilder; //导入依赖的package包/类
public static void main(String... args) throws IOException {
HazelcastInstance client =
HazelcastClient.newHazelcastClient(new XmlClientConfigBuilder("src/main/resources/hazelcast-client.xml").build());
try {
IMap<String, Language> map = client.getMap("language");
Stream
.generate(() -> System.console().readLine("Command> "))
.filter(Objects::nonNull)
.forEach(line -> {
String[] tokens = line.split("\\s+");
String command = tokens[0];
switch (command) {
case "put":
String key = tokens[1];
Language language = new Language(tokens[2]);
map.put(key, language);
System.out.printf("putted %s/%s%n", key, language);
break;
case "get":
System.out.printf("get => %s%n", map.get(tokens[1]));
break;
default:
System.out.printf("Unknown command => %s%n", command);
break;
}
});
} finally {
client.getLifecycleService().shutdown();
HazelcastClient.shutdownAll();
}
}
示例5: withConfig
import com.hazelcast.client.config.XmlClientConfigBuilder; //导入依赖的package包/类
public HazelcastClientInstanceFactoryBuilder withConfig(XmlClientConfigBuilder configBuilder) {
return withConfig(configBuilder.build());
}
示例6: initConfig
import com.hazelcast.client.config.XmlClientConfigBuilder; //导入依赖的package包/类
protected void initConfig() {
if (config == null) {
this.config = new XmlClientConfigBuilder().build();
}
}
示例7: createHazelcastClient
import com.hazelcast.client.config.XmlClientConfigBuilder; //导入依赖的package包/类
private HazelcastInstance createHazelcastClient() throws IOException {
File f = new File("hazelcast-client.xml");
XmlClientConfigBuilder builder = new XmlClientConfigBuilder(f);
config = builder.build();
return HazelcastClient.newHazelcastClient(config);
}
示例8: getClientConfig
import com.hazelcast.client.config.XmlClientConfigBuilder; //导入依赖的package包/类
public static ClientConfig getClientConfig(Properties properties) {
return new XmlClientConfigBuilder(getClientConfigStream(properties)).build();
}
示例9: buildClientConfig
import com.hazelcast.client.config.XmlClientConfigBuilder; //导入依赖的package包/类
protected ClientConfig buildClientConfig()
{
ClientConfig config = new XmlClientConfigBuilder().build();
config.setManagedContext( new CountingManagedContext() );
return config;
}
示例10: newClient
import com.hazelcast.client.config.XmlClientConfigBuilder; //导入依赖的package包/类
public static HazelcastInstance newClient(final String xmlConfiguration) throws IOException {
return HazelcastClient.newHazelcastClient(
new XmlClientConfigBuilder(IOs.findConfiguration(xmlConfiguration)).build());
}