Search in sources :

Example 1 with ClusteringConfiguration

use of org.infinispan.configuration.cache.ClusteringConfiguration in project wildfly by wildfly.

the class DataContainerFactory method createUnboundedContainer.

private DataContainer<?, ?> createUnboundedContainer() {
    ClusteringConfiguration clustering = this.configuration.clustering();
    boolean segmented = clustering.cacheMode().needsStateTransfer();
    int level = this.configuration.locking().concurrencyLevel();
    boolean offHeap = this.configuration.memory().isOffHeap();
    if (segmented) {
        Supplier<PeekableTouchableMap<WrappedBytes, WrappedBytes>> mapSupplier = offHeap ? this::createAndStartOffHeapConcurrentMap : PeekableTouchableContainerMap::new;
        int segments = clustering.hash().numSegments();
        return clustering.l1().enabled() ? new L1SegmentedDataContainer<>(mapSupplier, segments) : new DefaultSegmentedDataContainer<>(mapSupplier, segments);
    }
    return offHeap ? new OffHeapDataContainer() : DefaultDataContainer.unBoundedDataContainer(level);
}
Also used : OffHeapDataContainer(org.infinispan.container.offheap.OffHeapDataContainer) SegmentedBoundedOffHeapDataContainer(org.infinispan.container.offheap.SegmentedBoundedOffHeapDataContainer) BoundedOffHeapDataContainer(org.infinispan.container.offheap.BoundedOffHeapDataContainer) PeekableTouchableMap(org.infinispan.container.impl.PeekableTouchableMap) PeekableTouchableContainerMap(org.infinispan.container.impl.PeekableTouchableContainerMap) ClusteringConfiguration(org.infinispan.configuration.cache.ClusteringConfiguration)

Example 2 with ClusteringConfiguration

use of org.infinispan.configuration.cache.ClusteringConfiguration 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);
}
Also used : SegmentedBoundedOffHeapDataContainer(org.infinispan.container.offheap.SegmentedBoundedOffHeapDataContainer) BoundedOffHeapDataContainer(org.infinispan.container.offheap.BoundedOffHeapDataContainer) MemoryConfiguration(org.infinispan.configuration.cache.MemoryConfiguration) ClusteringConfiguration(org.infinispan.configuration.cache.ClusteringConfiguration) SegmentedBoundedOffHeapDataContainer(org.infinispan.container.offheap.SegmentedBoundedOffHeapDataContainer)

Aggregations

ClusteringConfiguration (org.infinispan.configuration.cache.ClusteringConfiguration)2 BoundedOffHeapDataContainer (org.infinispan.container.offheap.BoundedOffHeapDataContainer)2 SegmentedBoundedOffHeapDataContainer (org.infinispan.container.offheap.SegmentedBoundedOffHeapDataContainer)2 MemoryConfiguration (org.infinispan.configuration.cache.MemoryConfiguration)1 PeekableTouchableContainerMap (org.infinispan.container.impl.PeekableTouchableContainerMap)1 PeekableTouchableMap (org.infinispan.container.impl.PeekableTouchableMap)1 OffHeapDataContainer (org.infinispan.container.offheap.OffHeapDataContainer)1