Search in sources :

Example 1 with SortedEvictionPolicyFactory

use of org.apache.ignite.cache.eviction.sorted.SortedEvictionPolicyFactory in project ignite by apache.

the class EvictionPolicyFailureHandlerTest method getConfiguration.

/**
 * {@inheritDoc}
 */
@Override
protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
    IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
    cfg.setFailureHandler((ignite, failureCtx) -> {
        nodeFailure.set(true);
        return false;
    });
    SortedEvictionPolicyFactory plcFactory = new SortedEvictionPolicyFactory();
    plcFactory.setMaxSize(3);
    plcFactory.setBatchSize(10);
    plcFactory.setMaxMemorySize(10);
    cfg.setGridLogger(log);
    cfg.setCacheConfiguration(new CacheConfiguration<Integer, Integer>(DEFAULT_CACHE_NAME).setEvictionPolicyFactory(oom ? (Factory<ThrowableEvictionPolicy>) ThrowableEvictionPolicy::new : plcFactory).setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL).setOnheapCacheEnabled(true));
    return cfg;
}
Also used : IgniteConfiguration(org.apache.ignite.configuration.IgniteConfiguration) SortedEvictionPolicyFactory(org.apache.ignite.cache.eviction.sorted.SortedEvictionPolicyFactory) CacheConfiguration(org.apache.ignite.configuration.CacheConfiguration)

Aggregations

SortedEvictionPolicyFactory (org.apache.ignite.cache.eviction.sorted.SortedEvictionPolicyFactory)1 CacheConfiguration (org.apache.ignite.configuration.CacheConfiguration)1 IgniteConfiguration (org.apache.ignite.configuration.IgniteConfiguration)1