本文整理汇总了Java中com.hazelcast.config.FileSystemXmlConfig类的典型用法代码示例。如果您正苦于以下问题:Java FileSystemXmlConfig类的具体用法?Java FileSystemXmlConfig怎么用?Java FileSystemXmlConfig使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
FileSystemXmlConfig类属于com.hazelcast.config包,在下文中一共展示了FileSystemXmlConfig类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: ensureInstanceIsUp
import com.hazelcast.config.FileSystemXmlConfig; //导入依赖的package包/类
protected void ensureInstanceIsUp() throws Exception {
if (isInstanceNotActive(hz)) {
hz = Hazelcast.newHazelcastInstance(
new FileSystemXmlConfig(new File(sourceDir + "/WEB-INF/", "hazelcast.xml")));
}
if (serverXml1 != null) {
if (server1 == null) {
serverPort1 = availablePort();
server1 = getServletContainer(serverPort1, sourceDir, serverXml1);
} else if (!server1.isRunning()) {
server1.start();
}
}
if (serverXml2 != null) {
if (server2 == null) {
serverPort2 = availablePort();
server2 = getServletContainer(serverPort2, sourceDir, serverXml2);
} else if (!server2.isRunning()) {
server2.start();
}
}
}
示例2: whenClusterIsDown_enabledDeferredWrite
import com.hazelcast.config.FileSystemXmlConfig; //导入依赖的package包/类
@Test
public void whenClusterIsDown_enabledDeferredWrite() throws Exception {
CookieStore cookieStore = new BasicCookieStore();
assertEquals("true", executeRequest("write", serverPort1, cookieStore));
assertEquals("value", executeRequest("read", serverPort1, cookieStore));
hz.shutdown();
assertEquals("value", executeRequest("read", serverPort1, cookieStore));
assertEquals("true", executeRequest("remove", serverPort1, cookieStore));
assertEquals("null", executeRequest("read", serverPort1, cookieStore));
hz = Hazelcast.newHazelcastInstance(
new FileSystemXmlConfig(new File(sourceDir + "/WEB-INF/", "hazelcast.xml")));
assertClusterSizeEventually(1, hz);
assertEquals("true", executeRequest("write", serverPort1, cookieStore));
assertEquals("value", executeRequest("read", serverPort1, cookieStore));
}
示例3: whenClusterIsDownAtBeginning_enabledDeferredWrite
import com.hazelcast.config.FileSystemXmlConfig; //导入依赖的package包/类
@Test
public void whenClusterIsDownAtBeginning_enabledDeferredWrite() throws Exception {
hz.shutdown();
CookieStore cookieStore = new BasicCookieStore();
assertEquals("true", executeRequest("write", serverPort1, cookieStore));
assertEquals("value", executeRequest("read", serverPort1, cookieStore));
assertEquals("value", executeRequest("read", serverPort1, cookieStore));
assertEquals("true", executeRequest("remove", serverPort1, cookieStore));
assertEquals("null", executeRequest("read", serverPort1, cookieStore));
assertEquals("true", executeRequest("write", serverPort1, cookieStore));
assertEquals("value", executeRequest("read", serverPort1, cookieStore));
hz = Hazelcast.newHazelcastInstance(
new FileSystemXmlConfig(new File(sourceDir + "/WEB-INF/", "hazelcast.xml")));
assertClusterSizeEventually(1, hz);
assertEquals("value", executeRequest("read", serverPort1, cookieStore));
assertEquals("true", executeRequest("remove", serverPort1, cookieStore));
assertEquals("null", executeRequest("read", serverPort1, cookieStore));
}
示例4: testWhenClusterIsDownAtBeginningInNonDeferredMode
import com.hazelcast.config.FileSystemXmlConfig; //导入依赖的package包/类
@Test
public void testWhenClusterIsDownAtBeginningInNonDeferredMode() throws Exception {
if (!testName.equals("client - not deferred")) {
return;
}
hz.shutdown();
CookieStore cookieStore = new BasicCookieStore();
assertEquals("true", executeRequest("write", serverPort1, cookieStore));
assertEquals("value", executeRequest("read", serverPort1, cookieStore));
hz = Hazelcast.newHazelcastInstance(
new FileSystemXmlConfig(new File(sourceDir + "/WEB-INF/", "hazelcast.xml")));
assertClusterSizeEventually(1, hz);
assertEquals("value", executeRequest("read", serverPort1, cookieStore));
IMap<String, Object> map = hz.getMap(DEFAULT_MAP_NAME);
assertEquals(1, map.size());
}
示例5: testWhenClusterIsDownAtBeginningInDeferedMode
import com.hazelcast.config.FileSystemXmlConfig; //导入依赖的package包/类
@Test
public void testWhenClusterIsDownAtBeginningInDeferedMode() throws Exception {
if (!testName.equals("client - not deferred")) {
return;
}
hz.shutdown();
CookieStore cookieStore = new BasicCookieStore();
assertEquals("true", executeRequest("write", serverPort1, cookieStore));
assertEquals("value", executeRequest("read", serverPort1, cookieStore));
hz = Hazelcast.newHazelcastInstance(
new FileSystemXmlConfig(new File(sourceDir + "/WEB-INF/", "hazelcast.xml")));
assertClusterSizeEventually(1, hz);
assertEquals("value", executeRequest("read", serverPort1, cookieStore));
IMap<String, Object> map = hz.getMap(DEFAULT_MAP_NAME);
assertEquals(0, map.size());
}
示例6: ensureInstanceIsUp
import com.hazelcast.config.FileSystemXmlConfig; //导入依赖的package包/类
@Override
protected void ensureInstanceIsUp() throws Exception {
if (isInstanceNotActive(hz)) {
hz = Hazelcast.newHazelcastInstance(
new FileSystemXmlConfig(new File(sourceDir + "/WEB-INF/", "hazelcast.xml")));
}
if (serverXml1 != null) {
if (server1 == null) {
serverPort1 = availablePort();
server1 = getServletContainer(serverPort1, sourceDir, serverXml1);
} else if (!server1.isRunning()) {
server1.start();
}
}
if (serverXml2 != null) {
if (server2 == null) {
serverPort2 = availablePort();
server2 = getServletContainer(serverPort2, sourceDir, serverXml2);
} else if (!server2.isRunning()) {
server2.start();
}
}
}
示例7: start
import com.hazelcast.config.FileSystemXmlConfig; //导入依赖的package包/类
public void start() {
try {
logger.info("HazelcastServer starting");
File configurationFile = new File(CONFIGURATION_DIRECTORY, CONFIGURATION_FILENAME);
if (!configurationFile.exists()) {
try (FileOutputStream fos = new FileOutputStream(configurationFile)) {
fos.write(HybridbpmCoreUtil.getDefaultHazelcastConfig().getBytes());
}
}
configurationFile = new File(CONFIGURATION_DIRECTORY, CONFIGURATION_FILENAME);
hazelcastInstance = Hazelcast.newHazelcastInstance(new FileSystemXmlConfig(configurationFile));
logger.info("HazelcastServer started");
} catch (Exception ex) {
logger.log(Level.SEVERE, ex.getMessage(), ex);
}
}
示例8: activate
import com.hazelcast.config.FileSystemXmlConfig; //导入依赖的package包/类
@Activate
public void activate() {
try {
File hazelcastFile = new File(HAZELCAST_XML_FILE);
if (!hazelcastFile.exists()) {
createDefaultHazelcastFile(hazelcastFile);
}
Config config = new FileSystemXmlConfig(HAZELCAST_XML_FILE);
instance = Hazelcast.newHazelcastInstance(config);
log.info("Started");
} catch (FileNotFoundException e) {
log.error("Unable to configure Hazelcast", e);
}
}
示例9: configureHazelcast
import com.hazelcast.config.FileSystemXmlConfig; //导入依赖的package包/类
private void configureHazelcast(final Properties properties) {
if (null == hazelcast || !Hazelcast.getAllHazelcastInstances().contains(hazelcast)) {
String configFile = properties.getProperty(CACHE_CONFIG_FILE);
if (null == configFile) {
LOGGER.warn("Config file not set using system property: " + CACHE_CONFIG_FILE
+ ". Using default settings");
hazelcast = Hazelcast.newHazelcastInstance();
} else {
try {
final Config config = new FileSystemXmlConfig(configFile);
hazelcast = Hazelcast.newHazelcastInstance(config);
} catch (final Exception e) {
throw new IllegalArgumentException("Could not create cache using config path: " + configFile, e);
}
}
}
}
示例10: configureCluster
import com.hazelcast.config.FileSystemXmlConfig; //导入依赖的package包/类
private void configureCluster(IConfig config) throws FileNotFoundException {
LOG.info("Configuring embedded Hazelcast instance");
String interceptHandlerClassname = config.getProperty(BrokerConstants.INTERCEPT_HANDLER_PROPERTY_NAME);
if (interceptHandlerClassname == null || !HZ_INTERCEPT_HANDLER.equals(interceptHandlerClassname)) {
LOG.info("There are no Hazelcast intercept handlers. The server won't start a Hazelcast instance.");
return;
}
String hzConfigPath = config.getProperty(BrokerConstants.HAZELCAST_CONFIGURATION);
if (hzConfigPath != null) {
boolean isHzConfigOnClasspath = this.getClass().getClassLoader().getResource(hzConfigPath) != null;
Config hzconfig = isHzConfigOnClasspath
? new ClasspathXmlConfig(hzConfigPath)
: new FileSystemXmlConfig(hzConfigPath);
LOG.info("Starting Hazelcast instance. ConfigurationFile={}", hzconfig);
hazelcastInstance = Hazelcast.newHazelcastInstance(hzconfig);
} else {
LOG.info("Starting Hazelcast instance with default configuration");
hazelcastInstance = Hazelcast.newHazelcastInstance();
}
listenOnHazelCastMsg();
}
示例11: HazelcastInstanceProxy
import com.hazelcast.config.FileSystemXmlConfig; //导入依赖的package包/类
/**
*
* @param configFile
* @param entityBasePkg
* @throws FileNotFoundException
*/
public HazelcastInstanceProxy(File configFile, String entityBasePkg) throws FileNotFoundException
{
this(new FileSystemXmlConfig(configFile), entityBasePkg);
}