Class BoundedOffHeapDataContainer

    • Constructor Detail

      • BoundedOffHeapDataContainer

        public BoundedOffHeapDataContainer​(long maxSize,
                                           EvictionType type)
    • Method Detail

      • containsKey

        public boolean containsKey​(java.lang.Object k)
        Description copied from interface: DataContainer
        Tests whether an entry exists in the container
        Specified by:
        containsKey in interface DataContainer<WrappedBytes,​WrappedBytes>
        Overrides:
        containsKey in class org.infinispan.container.impl.AbstractDelegatingInternalDataContainer<WrappedBytes,​WrappedBytes>
        Parameters:
        k - key to test
        Returns:
        true if entry exists and has not expired; false otherwise
      • containsKey

        public boolean containsKey​(int segment,
                                   java.lang.Object k)
        Description copied from interface: org.infinispan.container.impl.InternalDataContainer
        Same as DataContainer.containsKey(Object) except that the segment of the key can provided to lookup if the entry exists without calculating the segment for the given key.
        Specified by:
        containsKey in interface org.infinispan.container.impl.InternalDataContainer<WrappedBytes,​WrappedBytes>
        Overrides:
        containsKey in class org.infinispan.container.impl.AbstractDelegatingInternalDataContainer<WrappedBytes,​WrappedBytes>
        Parameters:
        segment - segment for the key
        k - key under which entry is stored
        Returns:
        true if entry exists and has not expired; false otherwise
      • peek

        public InternalCacheEntry<WrappedBytes,​WrappedBytes> peek​(int segment,
                                                                        java.lang.Object k)
        Description copied from interface: org.infinispan.container.impl.InternalDataContainer
        Same as DataContainer.peek(Object) except that the segment of the key can provided to lookup entries without calculating the segment for the given key
        Specified by:
        peek in interface org.infinispan.container.impl.InternalDataContainer<WrappedBytes,​WrappedBytes>
        Overrides:
        peek in class org.infinispan.container.impl.AbstractDelegatingInternalDataContainer<WrappedBytes,​WrappedBytes>
        Parameters:
        segment - segment for the key
        k - key under which entry is stored
        Returns:
        entry, if it exists, or null if not
      • get

        public InternalCacheEntry<WrappedBytes,​WrappedBytes> get​(int segment,
                                                                       java.lang.Object k)
        Description copied from interface: org.infinispan.container.impl.InternalDataContainer
        Same as DataContainer.get(Object) except that the segment of the key can provided to lookup entries without calculating the segment for the given key
        Specified by:
        get in interface org.infinispan.container.impl.InternalDataContainer<WrappedBytes,​WrappedBytes>
        Overrides:
        get in class org.infinispan.container.impl.AbstractDelegatingInternalDataContainer<WrappedBytes,​WrappedBytes>
        Parameters:
        segment - segment for the key
        k - key under which entry is stored
        Returns:
        entry, if it exists and has not expired, or null if not
      • remove

        public InternalCacheEntry<WrappedBytes,​WrappedBytes> remove​(int segment,
                                                                          java.lang.Object k)
        Description copied from interface: org.infinispan.container.impl.InternalDataContainer
        Same as DataContainer.remove(Object) except that the segment of the key can provided to remove the entry without calculating the segment for the given key.
        Specified by:
        remove in interface org.infinispan.container.impl.InternalDataContainer<WrappedBytes,​WrappedBytes>
        Overrides:
        remove in class org.infinispan.container.impl.AbstractDelegatingInternalDataContainer<WrappedBytes,​WrappedBytes>
        Parameters:
        segment - segment for the key
        k - key to remove
        Returns:
        entry removed, or null if it didn't exist or had expired
      • evict

        public java.util.concurrent.CompletionStage<java.lang.Void> evict​(int segment,
                                                                          WrappedBytes key)
        Description copied from interface: org.infinispan.container.impl.InternalDataContainer
        Same as DataContainer.evict(Object) except that the segment of the key can provided to remove the entry without calculating the segment for the given key.
        Specified by:
        evict in interface org.infinispan.container.impl.InternalDataContainer<WrappedBytes,​WrappedBytes>
        Overrides:
        evict in class org.infinispan.container.impl.AbstractDelegatingInternalDataContainer<WrappedBytes,​WrappedBytes>
        Parameters:
        segment - segment for the key
        key - The key to evict.
      • put

        public void put​(int segment,
                        WrappedBytes key,
                        WrappedBytes value,
                        Metadata metadata,
                        long createdTimestamp,
                        long lastUseTimestamp)
        Description copied from interface: org.infinispan.container.impl.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 org.infinispan.container.impl.InternalDataContainer<WrappedBytes,​WrappedBytes>
        Overrides:
        put in class SegmentedBoundedOffHeapDataContainer
        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
      • spliterator

        public java.util.Spliterator<InternalCacheEntry<WrappedBytes,​WrappedBytes>> spliterator​(IntSet segments)
        Description copied from interface: org.infinispan.container.impl.InternalDataContainer
        Same as DataContainer.spliterator() except that only entries that map to the provided segments are returned via this spliterator. The spliterator will not return expired entries.
        Specified by:
        spliterator in interface org.infinispan.container.impl.InternalDataContainer<WrappedBytes,​WrappedBytes>
        Overrides:
        spliterator in class org.infinispan.container.impl.AbstractDelegatingInternalDataContainer<WrappedBytes,​WrappedBytes>
        Parameters:
        segments - segments of entries to return
        Returns:
        spliterator containing entries mapping to those segments that aren't expired
      • spliteratorIncludingExpired

        public java.util.Spliterator<InternalCacheEntry<WrappedBytes,​WrappedBytes>> spliteratorIncludingExpired​(IntSet segments)
        Description copied from interface: org.infinispan.container.impl.InternalDataContainer
        Same as DataContainer.spliteratorIncludingExpired() except that only entries that map to the provided segments are returned via this spliterator. The spliterator will return expired entries as well.
        Specified by:
        spliteratorIncludingExpired in interface org.infinispan.container.impl.InternalDataContainer<WrappedBytes,​WrappedBytes>
        Overrides:
        spliteratorIncludingExpired in class org.infinispan.container.impl.AbstractDelegatingInternalDataContainer<WrappedBytes,​WrappedBytes>
        Parameters:
        segments - segments of entries to use
        Returns:
        spliterator containing entries mapping to those segments that could be expired
      • iterator

        public java.util.Iterator<InternalCacheEntry<WrappedBytes,​WrappedBytes>> iterator​(IntSet segments)
        Description copied from interface: org.infinispan.container.impl.InternalDataContainer
        Same as DataContainer.iterator() except that only entries that map to the provided segments are returned via the iterator. The iterator will not return expired entries.
        Specified by:
        iterator in interface org.infinispan.container.impl.InternalDataContainer<WrappedBytes,​WrappedBytes>
        Overrides:
        iterator in class org.infinispan.container.impl.AbstractDelegatingInternalDataContainer<WrappedBytes,​WrappedBytes>
        Parameters:
        segments - segments of entries to use
        Returns:
        iterator that returns all entries mapped to the given segments
      • iteratorIncludingExpired

        public java.util.Iterator<InternalCacheEntry<WrappedBytes,​WrappedBytes>> iteratorIncludingExpired​(IntSet segments)
        Description copied from interface: org.infinispan.container.impl.InternalDataContainer
        Same as DataContainer.iteratorIncludingExpired() except that only entries that map to the provided segments are returned via the iterator. The iterator can return expired entries.
        Specified by:
        iteratorIncludingExpired in interface org.infinispan.container.impl.InternalDataContainer<WrappedBytes,​WrappedBytes>
        Overrides:
        iteratorIncludingExpired in class org.infinispan.container.impl.AbstractDelegatingInternalDataContainer<WrappedBytes,​WrappedBytes>
        Parameters:
        segments - segments of entries to use
        Returns:
        iterator that returns all entries mapped to the given segments that could be expired
      • sizeIncludingExpired

        public int sizeIncludingExpired​(IntSet segments)
        Description copied from interface: org.infinispan.container.impl.InternalDataContainer
        Returns how many entries are present in the data container that map to the given segments including any entries that may be expired
        Specified by:
        sizeIncludingExpired in interface org.infinispan.container.impl.InternalDataContainer<WrappedBytes,​WrappedBytes>
        Overrides:
        sizeIncludingExpired in class org.infinispan.container.impl.AbstractDelegatingInternalDataContainer<WrappedBytes,​WrappedBytes>
        Parameters:
        segments - segments of entries to count
        Returns:
        count of the number of entries in the container including expired entries
      • size

        public int size​(IntSet segments)
        Description copied from interface: org.infinispan.container.impl.InternalDataContainer
        Returns how many entries are present in the data container that map to the given segments without counting entries that are currently expired.
        Specified by:
        size in interface org.infinispan.container.impl.InternalDataContainer<WrappedBytes,​WrappedBytes>
        Overrides:
        size in class org.infinispan.container.impl.AbstractDelegatingInternalDataContainer<WrappedBytes,​WrappedBytes>
        Parameters:
        segments - segments of entries to count
        Returns:
        count of the number of entries in the container excluding expired entries
      • addRemovalListener

        public void addRemovalListener​(java.util.function.Consumer<java.lang.Iterable<InternalCacheEntry<WrappedBytes,​WrappedBytes>>> listener)
        Description copied from interface: org.infinispan.container.impl.InternalDataContainer
        Adds a listener that is invoked whenever InternalDataContainer.removeSegments(IntSet) is invoked providing a way for the listener to see what actual entries were removed from the container.
        Specified by:
        addRemovalListener in interface org.infinispan.container.impl.InternalDataContainer<WrappedBytes,​WrappedBytes>
        Overrides:
        addRemovalListener in class org.infinispan.container.impl.AbstractDelegatingInternalDataContainer<WrappedBytes,​WrappedBytes>
        Parameters:
        listener - listener that invoked of removed entries
      • removeRemovalListener

        public void removeRemovalListener​(java.lang.Object listener)
        Description copied from interface: org.infinispan.container.impl.InternalDataContainer
        Removes a previously registered listener via InternalDataContainer.addRemovalListener(Consumer).
        Specified by:
        removeRemovalListener in interface org.infinispan.container.impl.InternalDataContainer<WrappedBytes,​WrappedBytes>
        Overrides:
        removeRemovalListener in class org.infinispan.container.impl.AbstractDelegatingInternalDataContainer<WrappedBytes,​WrappedBytes>
        Parameters:
        listener - the listener to remove
      • addSegments

        public void addSegments​(IntSet segments)
        Description copied from interface: org.infinispan.container.impl.InternalDataContainer
        Sets what segments this data container should be using. Already associated segments are unaffected by this and takes a union of existing and new segments.
        Specified by:
        addSegments in interface org.infinispan.container.impl.InternalDataContainer<WrappedBytes,​WrappedBytes>
        Overrides:
        addSegments in class org.infinispan.container.impl.AbstractDelegatingInternalDataContainer<WrappedBytes,​WrappedBytes>
        Parameters:
        segments - segments to associate with this container
      • removeSegments

        public void removeSegments​(IntSet segments)
        Description copied from interface: org.infinispan.container.impl.InternalDataContainer
        Removes and un-associates the given segments. This will notify any listeners registered via InternalDataContainer.addRemovalListener(Consumer) of entries that were removed due to no longer being associated with this container. There is no guarantee if the consumer is invoked once or multiple times for a given group of segments and could be in any order.

        When this method is invoked an implementation is free to remove any entries that don't map to segments currently associated with this container. Note that entries that were removed due to their segments never being associated with this container do not notify listeners registered via InternalDataContainer.addRemovalListener(Consumer).

        Specified by:
        removeSegments in interface org.infinispan.container.impl.InternalDataContainer<WrappedBytes,​WrappedBytes>
        Overrides:
        removeSegments in class org.infinispan.container.impl.AbstractDelegatingInternalDataContainer<WrappedBytes,​WrappedBytes>
        Parameters:
        segments - segments that should no longer be associated with this container