use of com.hazelcast.config.NearCachePreloaderConfig in project hazelcast by hazelcast.
the class XmlClientConfigBuilder method getNearCachePreloaderConfig.
private NearCachePreloaderConfig getNearCachePreloaderConfig(Node node) {
NearCachePreloaderConfig preloaderConfig = new NearCachePreloaderConfig();
String enabled = getAttribute(node, "enabled");
String directory = getAttribute(node, "directory");
String storeInitialDelaySeconds = getAttribute(node, "store-initial-delay-seconds");
String storeIntervalSeconds = getAttribute(node, "store-interval-seconds");
if (enabled != null) {
preloaderConfig.setEnabled(getBooleanValue(enabled));
}
if (directory != null) {
preloaderConfig.setDirectory(directory);
}
if (storeInitialDelaySeconds != null) {
preloaderConfig.setStoreInitialDelaySeconds(getIntegerValue("storage-initial-delay-seconds", storeInitialDelaySeconds));
}
if (storeIntervalSeconds != null) {
preloaderConfig.setStoreIntervalSeconds(getIntegerValue("storage-interval-seconds", storeIntervalSeconds));
}
return preloaderConfig;
}
use of com.hazelcast.config.NearCachePreloaderConfig in project hazelcast by hazelcast.
the class ClientDomConfigProcessor method getNearCachePreloaderConfig.
private NearCachePreloaderConfig getNearCachePreloaderConfig(Node node) {
NearCachePreloaderConfig preloaderConfig = new NearCachePreloaderConfig();
String enabled = getAttribute(node, "enabled");
String directory = getAttribute(node, "directory");
String storeInitialDelaySeconds = getAttribute(node, "store-initial-delay-seconds");
String storeIntervalSeconds = getAttribute(node, "store-interval-seconds");
if (enabled != null) {
preloaderConfig.setEnabled(getBooleanValue(enabled));
}
if (directory != null) {
preloaderConfig.setDirectory(directory);
}
if (storeInitialDelaySeconds != null) {
preloaderConfig.setStoreInitialDelaySeconds(getIntegerValue("storage-initial-delay-seconds", storeInitialDelaySeconds));
}
if (storeIntervalSeconds != null) {
preloaderConfig.setStoreIntervalSeconds(getIntegerValue("storage-interval-seconds", storeIntervalSeconds));
}
return preloaderConfig;
}
use of com.hazelcast.config.NearCachePreloaderConfig in project hazelcast by hazelcast.
the class DefaultNearCacheManager method startPreloading.
@Override
public void startPreloading(NearCache nearCache, DataStructureAdapter dataStructureAdapter) {
NearCacheConfig nearCacheConfig = nearCache.getNearCacheConfig();
NearCachePreloaderConfig preloaderConfig = nearCacheConfig.getPreloaderConfig();
if (preloaderConfig.isEnabled()) {
createAndSchedulePreloadTask(nearCache, dataStructureAdapter);
createAndScheduleStorageTask();
}
}
use of com.hazelcast.config.NearCachePreloaderConfig in project hazelcast by hazelcast.
the class CustomTypeFactory method createNearCachePreloaderConfig.
public static NearCachePreloaderConfig createNearCachePreloaderConfig(boolean enabled, String directory, int storeInitialDelaySeconds, int storeIntervalSeconds) {
NearCachePreloaderConfig config = new NearCachePreloaderConfig();
config.setEnabled(enabled);
config.setDirectory(directory);
config.setStoreInitialDelaySeconds(storeInitialDelaySeconds);
config.setStoreIntervalSeconds(storeIntervalSeconds);
return config;
}
use of com.hazelcast.config.NearCachePreloaderConfig in project hazelcast by hazelcast.
the class ClientConfigXmlGeneratorTest method nearCache.
@Test
public void nearCache() {
NearCacheConfig expected = createNearCacheConfig(randomString()).setPreloaderConfig(new NearCachePreloaderConfig().setEnabled(true).setDirectory(randomString()).setStoreInitialDelaySeconds(randomInt()).setStoreIntervalSeconds(randomInt())).setEvictionConfig(new EvictionConfig().setEvictionPolicy(LFU).setMaxSizePolicy(USED_NATIVE_MEMORY_SIZE).setComparatorClassName(randomString()).setSize(randomInt()));
clientConfig.addNearCacheConfig(expected);
Map<String, NearCacheConfig> actual = newConfigViaGenerator().getNearCacheConfigMap();
assertMap(clientConfig.getNearCacheConfigMap(), actual);
}
Aggregations