use of com.hazelcast.config.EvictionConfig in project hazelcast by hazelcast.
the class ConfigValidatorTest method getEvictionConfig.
private EvictionConfig getEvictionConfig(boolean setComparatorClass, boolean setComparator, EvictionPolicy evictionPolicy) {
EvictionConfig evictionConfig = new EvictionConfig();
if (setComparatorClass) {
evictionConfig.setComparatorClassName("myComparatorClass");
}
if (setComparator) {
evictionConfig.setComparator(new EvictionPolicyComparator() {
@Override
@SuppressWarnings("ComparatorMethodParameterNotUsed")
public int compare(EvictableEntryView e1, EvictableEntryView e2) {
return 0;
}
@Override
@SuppressWarnings("ComparatorMethodParameterNotUsed")
public int compare(Object o1, Object o2) {
return 0;
}
});
}
evictionConfig.setEvictionPolicy(evictionPolicy);
return evictionConfig;
}
use of com.hazelcast.config.EvictionConfig in project hazelcast by hazelcast.
the class XmlClientConfigBuilder method getEvictionConfig.
private EvictionConfig getEvictionConfig(Node node) {
EvictionConfig evictionConfig = new EvictionConfig();
Node size = node.getAttributes().getNamedItem("size");
Node maxSizePolicy = node.getAttributes().getNamedItem("max-size-policy");
Node evictionPolicy = node.getAttributes().getNamedItem("eviction-policy");
if (size != null) {
evictionConfig.setSize(Integer.parseInt(getTextContent(size)));
}
if (maxSizePolicy != null) {
evictionConfig.setMaximumSizePolicy(MaxSizePolicy.valueOf(upperCaseInternal(getTextContent(maxSizePolicy))));
}
if (evictionPolicy != null) {
evictionConfig.setEvictionPolicy(EvictionPolicy.valueOf(upperCaseInternal(getTextContent(evictionPolicy))));
}
return evictionConfig;
}
use of com.hazelcast.config.EvictionConfig in project hazelcast by hazelcast.
the class AbstractNearCacheRecordStore method initialize.
@Override
public void initialize() {
EvictionConfig evictionConfig = nearCacheConfig.getEvictionConfig();
this.records = createNearCacheRecordMap(nearCacheConfig);
this.evictionChecker = createNearCacheEvictionChecker(evictionConfig, nearCacheConfig);
this.evictionPolicyEvaluator = createEvictionPolicyEvaluator(evictionConfig);
this.evictionStrategy = createEvictionStrategy(evictionConfig);
this.evictionPolicyType = evictionConfig.getEvictionPolicyType();
}
Aggregations