use of org.infinispan.container.offheap.BoundedOffHeapDataContainer in project wildfly by wildfly.
the class DataContainerFactory method createBoundedDataContainer.
@SuppressWarnings("deprecation")
private DataContainer<?, ?> createBoundedDataContainer() {
ClusteringConfiguration clustering = this.configuration.clustering();
boolean segmented = clustering.cacheMode().needsStateTransfer();
int level = this.configuration.locking().concurrencyLevel();
MemoryConfiguration memory = this.configuration.memory();
boolean offHeap = memory.isOffHeap();
long maxEntries = memory.maxCount();
long maxBytes = memory.maxSizeBytes();
org.infinispan.eviction.EvictionType type = memory.evictionType();
DataContainerConfiguration config = this.configuration.module(DataContainerConfiguration.class);
Predicate<?> evictable = (config != null) ? config.evictable() : DataContainerConfiguration.EVICTABLE_PREDICATE.getDefaultValue();
if (segmented) {
int segments = clustering.hash().numSegments();
if (offHeap) {
return new SegmentedBoundedOffHeapDataContainer(segments, maxEntries, type);
}
return (maxEntries > 0) ? new BoundedSegmentedDataContainer<>(segments, maxEntries, new EvictableEntrySizeCalculator<>(evictable)) : new BoundedSegmentedDataContainer<>(segments, maxBytes, type);
}
if (offHeap) {
return new BoundedOffHeapDataContainer(maxEntries, type);
}
return (maxEntries > 0) ? new EvictableDataContainer<>(maxEntries, new EvictableEntrySizeCalculator<>(evictable)) : DefaultDataContainer.boundedDataContainer(level, maxBytes, type);
}
Aggregations