Search in sources :

Example 1 with NearCachePreloaderConfig

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;
}
Also used : NearCachePreloaderConfig(com.hazelcast.config.NearCachePreloaderConfig)

Example 2 with NearCachePreloaderConfig

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;
}
Also used : NearCachePreloaderConfig(com.hazelcast.config.NearCachePreloaderConfig)

Example 3 with NearCachePreloaderConfig

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();
    }
}
Also used : NearCachePreloaderConfig(com.hazelcast.config.NearCachePreloaderConfig) NearCacheConfig(com.hazelcast.config.NearCacheConfig)

Example 4 with NearCachePreloaderConfig

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;
}
Also used : NearCachePreloaderConfig(com.hazelcast.config.NearCachePreloaderConfig)

Example 5 with NearCachePreloaderConfig

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);
}
Also used : EvictionConfig(com.hazelcast.config.EvictionConfig) NearCachePreloaderConfig(com.hazelcast.config.NearCachePreloaderConfig) NearCacheConfig(com.hazelcast.config.NearCacheConfig) ParallelJVMTest(com.hazelcast.test.annotation.ParallelJVMTest) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test)

Aggregations

NearCachePreloaderConfig (com.hazelcast.config.NearCachePreloaderConfig)10 EvictionConfig (com.hazelcast.config.EvictionConfig)5 NearCacheConfig (com.hazelcast.config.NearCacheConfig)5 QuickTest (com.hazelcast.test.annotation.QuickTest)3 Test (org.junit.Test)3 AttributeConfig (com.hazelcast.config.AttributeConfig)2 EntryListenerConfig (com.hazelcast.config.EntryListenerConfig)2 HotRestartConfig (com.hazelcast.config.HotRestartConfig)2 IndexConfig (com.hazelcast.config.IndexConfig)2 MapConfig (com.hazelcast.config.MapConfig)2 MapPartitionLostListenerConfig (com.hazelcast.config.MapPartitionLostListenerConfig)2 MapStoreConfig (com.hazelcast.config.MapStoreConfig)2 PartitioningStrategyConfig (com.hazelcast.config.PartitioningStrategyConfig)2 QueryCacheConfig (com.hazelcast.config.QueryCacheConfig)2 WanReplicationRef (com.hazelcast.config.WanReplicationRef)2 AwsConfig (com.hazelcast.config.AwsConfig)1 AzureConfig (com.hazelcast.config.AzureConfig)1 BitmapIndexOptions (com.hazelcast.config.BitmapIndexOptions)1 CachePartitionLostListenerConfig (com.hazelcast.config.CachePartitionLostListenerConfig)1 CacheSimpleConfig (com.hazelcast.config.CacheSimpleConfig)1