Class SegmentedBoundedOffHeapDataContainer

java.lang.Object
org.infinispan.container.impl.AbstractDelegatingInternalDataContainer<org.infinispan.commons.marshall.WrappedBytes,org.infinispan.commons.marshall.WrappedBytes>
org.infinispan.container.offheap.SegmentedBoundedOffHeapDataContainer
All Implemented Interfaces:
Iterable<InternalCacheEntry<org.infinispan.commons.marshall.WrappedBytes,org.infinispan.commons.marshall.WrappedBytes>>, DataContainer<org.infinispan.commons.marshall.WrappedBytes,org.infinispan.commons.marshall.WrappedBytes>, InternalDataContainer<org.infinispan.commons.marshall.WrappedBytes,org.infinispan.commons.marshall.WrappedBytes>
Direct Known Subclasses:
BoundedOffHeapDataContainer

public class SegmentedBoundedOffHeapDataContainer extends AbstractDelegatingInternalDataContainer<org.infinispan.commons.marshall.WrappedBytes,org.infinispan.commons.marshall.WrappedBytes>
Since:
9.4
Author:
wburns
  • Field Details

  • Constructor Details

    • SegmentedBoundedOffHeapDataContainer

      public SegmentedBoundedOffHeapDataContainer(int numSegments, long maxSize, EvictionType type)
  • Method Details

    • start

      public void start()
    • stop

      public void stop()
    • delegate

      protected InternalDataContainer<org.infinispan.commons.marshall.WrappedBytes,org.infinispan.commons.marshall.WrappedBytes> delegate()
      Specified by:
      delegate in class AbstractDelegatingInternalDataContainer<org.infinispan.commons.marshall.WrappedBytes,org.infinispan.commons.marshall.WrappedBytes>
    • put

      public void put(org.infinispan.commons.marshall.WrappedBytes key, org.infinispan.commons.marshall.WrappedBytes value, Metadata metadata)
      Description copied from interface: DataContainer
      Puts an entry in the cache along with metadata adding information such lifespan of entry, max idle time, version information...etc.

      The key must be activate by invoking ActivationManager.activateAsync(Object, int) boolean)}.

      Specified by:
      put in interface DataContainer<org.infinispan.commons.marshall.WrappedBytes,org.infinispan.commons.marshall.WrappedBytes>
      Overrides:
      put in class AbstractDelegatingInternalDataContainer<org.infinispan.commons.marshall.WrappedBytes,org.infinispan.commons.marshall.WrappedBytes>
      Parameters:
      key - key under which to store entry
      value - value to store
      metadata - metadata of the entry
    • put

      public void put(int segment, org.infinispan.commons.marshall.WrappedBytes key, org.infinispan.commons.marshall.WrappedBytes value, Metadata metadata, PrivateMetadata internalMetadata, long createdTimestamp, long lastUseTimestamp)
      Description copied from interface: InternalDataContainer
      Same as DataContainer.put(Object, Object, Metadata) except that the segment of the key can provided to write/lookup entries without calculating the segment for the given key.

      Note: The timestamps ignored if the entry already exists in the data container.

      Specified by:
      put in interface InternalDataContainer<org.infinispan.commons.marshall.WrappedBytes,org.infinispan.commons.marshall.WrappedBytes>
      Overrides:
      put in class AbstractDelegatingInternalDataContainer<org.infinispan.commons.marshall.WrappedBytes,org.infinispan.commons.marshall.WrappedBytes>
      Parameters:
      segment - segment for the key
      key - key under which to store entry
      value - value to store
      metadata - metadata of the entry
      createdTimestamp - creation timestamp, or -1 to use the current time
      lastUseTimestamp - last use timestamp, or -1 to use the current time
    • compute

      public InternalCacheEntry<org.infinispan.commons.marshall.WrappedBytes,org.infinispan.commons.marshall.WrappedBytes> compute(org.infinispan.commons.marshall.WrappedBytes key, DataContainer.ComputeAction<org.infinispan.commons.marshall.WrappedBytes,org.infinispan.commons.marshall.WrappedBytes> action)
      Description copied from interface: DataContainer
      Computes the new value for the key.

      See DataContainer.ComputeAction.compute(Object, org.infinispan.container.entries.InternalCacheEntry, InternalEntryFactory).

      The key must be activated by invoking ActivationManager.activateAsync(Object, int).

      Note the entry provided to DataContainer.ComputeAction may be expired as these entries are not filtered as many other methods do.

      Specified by:
      compute in interface DataContainer<org.infinispan.commons.marshall.WrappedBytes,org.infinispan.commons.marshall.WrappedBytes>
      Overrides:
      compute in class AbstractDelegatingInternalDataContainer<org.infinispan.commons.marshall.WrappedBytes,org.infinispan.commons.marshall.WrappedBytes>
      Parameters:
      key - The key.
      action - The action that will compute the new value.
      Returns:
      The InternalCacheEntry associated to the key.
    • compute

      public InternalCacheEntry<org.infinispan.commons.marshall.WrappedBytes,org.infinispan.commons.marshall.WrappedBytes> compute(int segment, org.infinispan.commons.marshall.WrappedBytes key, DataContainer.ComputeAction<org.infinispan.commons.marshall.WrappedBytes,org.infinispan.commons.marshall.WrappedBytes> action)
      Description copied from interface: InternalDataContainer
      Same as DataContainer.compute(Object, ComputeAction) except that the segment of the key can provided to update entries without calculating the segment for the given key.
      Specified by:
      compute in interface InternalDataContainer<org.infinispan.commons.marshall.WrappedBytes,org.infinispan.commons.marshall.WrappedBytes>
      Overrides:
      compute in class AbstractDelegatingInternalDataContainer<org.infinispan.commons.marshall.WrappedBytes,org.infinispan.commons.marshall.WrappedBytes>
      Parameters:
      segment - segment for the key
      key - The key.
      action - The action that will compute the new value.
      Returns:
      The InternalCacheEntry associated to the key.
    • getMapThatContainsKey

      protected OffHeapConcurrentMap getMapThatContainsKey(byte[] key)
    • getSize

      public long getSize(long address)
    • capacity

      public long capacity()
      Description copied from interface: DataContainer
      Returns the capacity of the underlying container. This is only supported if the container is bounded. An UnsupportedOperationException is thrown otherwise.
      Specified by:
      capacity in interface DataContainer<org.infinispan.commons.marshall.WrappedBytes,org.infinispan.commons.marshall.WrappedBytes>
      Overrides:
      capacity in class AbstractDelegatingInternalDataContainer<org.infinispan.commons.marshall.WrappedBytes,org.infinispan.commons.marshall.WrappedBytes>
      Returns:
    • evictionSize

      public long evictionSize()
      Description copied from interface: DataContainer
      Returns how large the eviction size is currently. This is only supported if the container is bounded. An UnsupportedOperationException is thrown otherwise. This value will always be lower than the value returned from DataContainer.capacity()
      Specified by:
      evictionSize in interface DataContainer<org.infinispan.commons.marshall.WrappedBytes,org.infinispan.commons.marshall.WrappedBytes>
      Overrides:
      evictionSize in class AbstractDelegatingInternalDataContainer<org.infinispan.commons.marshall.WrappedBytes,org.infinispan.commons.marshall.WrappedBytes>
      Returns:
      how large the counted eviction is