Class ConcurrentReferenceHashMap.Segment

    • Constructor Detail

      • Segment

        public Segment​(int initialSize,
                       int resizeThreshold)
    • Method Detail

      • doTask

        @Nullable
        public <T> T doTask​(int hash,
                            @Nullable
                            Object key,
                            org.springframework.util.ConcurrentReferenceHashMap.Task<T> task)
        Apply an update operation to this segment. The segment will be locked during the update.
        Parameters:
        hash - the hash of the key
        key - the key
        task - the update operation
        Returns:
        the result of the operation
      • clear

        public void clear()
        Clear all items from this segment.
      • restructureIfNecessary

        protected final void restructureIfNecessary​(boolean allowResize)
        Restructure the underlying data structure when it becomes necessary. This method can increase the size of the references table as well as purge any references that have been garbage collected.
        Parameters:
        allowResize - if resizing is permitted
      • getSize

        public final int getSize()
        Return the size of the current references array.
      • getCount

        public final int getCount()
        Return the total number of references in this segment.