use of com.hazelcast.config.MapStoreConfig in project hazelcast by hazelcast.
the class WriteBehindUponMigrationTest method createConfig.
private static Config createConfig(String mapName, MapStoreTest.SimpleMapStore store) {
MapStoreConfig mapStoreConfig = new MapStoreConfig();
mapStoreConfig.setImplementation(store).setWriteDelaySeconds(100).setWriteBatchSize(1).setWriteCoalescing(false);
Config config = new Config();
config.getMapConfig(mapName).setBackupCount(1).setMapStoreConfig(mapStoreConfig);
return config;
}
use of com.hazelcast.config.MapStoreConfig in project hazelcast by hazelcast.
the class WriteBehindWriteDelaySecondsTest method newMapStoredConfig.
private Config newMapStoredConfig(MapStore store, int writeDelaySeconds) {
MapStoreConfig mapStoreConfig = new MapStoreConfig();
mapStoreConfig.setEnabled(true);
mapStoreConfig.setWriteDelaySeconds(writeDelaySeconds);
mapStoreConfig.setImplementation(store);
Config config = getConfig();
MapConfig mapConfig = config.getMapConfig("default");
mapConfig.setMapStoreConfig(mapStoreConfig);
return config;
}
use of com.hazelcast.config.MapStoreConfig in project hazelcast by hazelcast.
the class EntryProcessorTest method testIssue1022.
@Test
public void testIssue1022() {
TestHazelcastInstanceFactory nodeFactory = createHazelcastInstanceFactory(2);
Config cfg = getConfig();
MapStoreConfig mapStoreConfig = new MapStoreConfig();
mapStoreConfig.setEnabled(true);
mapStoreConfig.setImplementation(new MapLoader<Integer, Integer>() {
public Integer load(Integer key) {
return 123;
}
public Map<Integer, Integer> loadAll(Collection<Integer> keys) {
return null;
}
public Set<Integer> loadAllKeys() {
return null;
}
});
cfg.getMapConfig(MAP_NAME).setMapStoreConfig(mapStoreConfig);
HazelcastInstance instance = nodeFactory.newHazelcastInstance(cfg);
EntryProcessor entryProcessor = new IncrementorEntryProcessor();
instance.getMap(MAP_NAME).executeOnKey(1, entryProcessor);
assertEquals(124, instance.getMap(MAP_NAME).get(1));
instance.shutdown();
}
use of com.hazelcast.config.MapStoreConfig in project ddf by codice.
the class HazelcastNotificationStore method getHazelcastConfig.
private Config getHazelcastConfig(BundleContext context, String xmlConfigFilename) {
Config cfg = null;
Bundle bundle = context.getBundle();
URL xmlConfigFileUrl = null;
if (StringUtils.isNotBlank(xmlConfigFilename)) {
xmlConfigFileUrl = bundle.getResource(xmlConfigFilename);
}
XmlConfigBuilder xmlConfigBuilder = null;
if (xmlConfigFileUrl != null) {
try {
xmlConfigBuilder = new XmlConfigBuilder(xmlConfigFileUrl.openStream());
cfg = xmlConfigBuilder.build();
LOGGER.debug("Successfully built hazelcast config from XML config file {}", xmlConfigFilename);
} catch (FileNotFoundException e) {
LOGGER.info("FileNotFoundException trying to build hazelcast config from XML file " + xmlConfigFilename, e);
cfg = null;
} catch (IOException e) {
LOGGER.info("IOException trying to build hazelcast config from XML file " + xmlConfigFilename, e);
cfg = null;
}
}
if (cfg == null) {
LOGGER.info("Falling back to using generic Config for hazelcast");
cfg = new Config();
} else if (LOGGER.isDebugEnabled()) {
MapConfig mapConfig = cfg.getMapConfig("persistentNotifications");
if (mapConfig == null) {
LOGGER.debug("mapConfig is NULL for persistentNotifications - try persistent*");
mapConfig = cfg.getMapConfig("persistent*");
if (mapConfig == null) {
LOGGER.debug("mapConfig is NULL for persistent*");
}
} else {
MapStoreConfig mapStoreConfig = mapConfig.getMapStoreConfig();
if (mapStoreConfig != null) {
LOGGER.debug("mapStoreConfig factoryClassName = {}", mapStoreConfig.getFactoryClassName());
} else {
LOGGER.debug("mapStoreConfig is null");
}
}
}
return cfg;
}
use of com.hazelcast.config.MapStoreConfig in project ddf by codice.
the class ResourceCacheImpl method getHazelcastConfig.
private Config getHazelcastConfig(BundleContext context, String xmlConfigFilename) {
Config cfg = null;
Bundle bundle = context.getBundle();
URL xmlConfigFileUrl = null;
if (StringUtils.isNotBlank(xmlConfigFilename)) {
xmlConfigFileUrl = bundle.getResource(xmlConfigFilename);
}
XmlConfigBuilder xmlConfigBuilder = null;
if (xmlConfigFileUrl != null) {
try {
xmlConfigBuilder = new XmlConfigBuilder(xmlConfigFileUrl.openStream());
cfg = xmlConfigBuilder.build();
LOGGER.debug("Successfully built hazelcast config from XML config file {}", xmlConfigFilename);
} catch (FileNotFoundException e) {
LOGGER.info("FileNotFoundException trying to build hazelcast config from XML file " + xmlConfigFilename, e);
cfg = null;
} catch (IOException e) {
LOGGER.info("IOException trying to build hazelcast config from XML file " + xmlConfigFilename, e);
cfg = null;
}
}
if (cfg == null) {
LOGGER.info("Falling back to using generic Config for hazelcast");
cfg = new Config();
} else if (LOGGER.isDebugEnabled()) {
MapConfig mapConfig = cfg.getMapConfig("Product_Cache");
if (mapConfig == null) {
LOGGER.debug("mapConfig is NULL for persistentNotifications - try persistent*");
mapConfig = cfg.getMapConfig("persistent*");
if (mapConfig == null) {
LOGGER.debug("mapConfig is NULL for persistent*");
}
} else {
MapStoreConfig mapStoreConfig = mapConfig.getMapStoreConfig();
if (null != mapStoreConfig) {
LOGGER.debug("mapStoreConfig factoryClassName = {}", mapStoreConfig.getFactoryClassName());
}
}
}
return cfg;
}
Aggregations