Interface SegmentedHashMap.EntryAction

All Known Subinterfaces:
SegmentedHashMap.IterableEntryAction
All Known Implementing Classes:
SegmentedConcurrentMap.ConditionalRemoveAction, SegmentedConcurrentMap.LockAction, SegmentedConcurrentMap.RemoveAction, SegmentedConcurrentMap.SizeAction, SegmentedConcurrentMap.UnlockAction, SegmentedHashMap.ContainsValueAction, SegmentedHashMap.EntryActionAdapter, SegmentedHashMap.GetEntryAction, SegmentedHashMap.InsertAction, SegmentedHashMap.RemoveAction
Enclosing class:
SegmentedHashMap

protected static interface SegmentedHashMap.EntryAction
An EntryAction encapsulates a logical action to be executed in the context of a key (that may or may not exist in the map). If an Entry exists in the map for the key, invokeFound is called; otherwise invokeNotFound is called.

EntryAction instances are state-aware and are invoked with an opaque context object supplied by the action client. The meanings of the supplied context and return-values are polymorphic in EntryAction type. Depending on the EntryAction type, it may or may not be invoked while holding the segment lock for the key.

An EntryAction should not acquire additional segment-locks.

  • Method Details

    • invokeFound

      Object invokeFound(Object oKey, Object oContext, SegmentedHashMap.Entry[] aeBucket, int nBucket, SegmentedHashMap.Entry entryPrev, SegmentedHashMap.Entry entryCur)
      Invoke some action, holding the segment lock, when a matching Entry is found.
      Parameters:
      oKey - the key to which the action is applied
      oContext - opaque context specific to the action
      aeBucket - the bucket array
      nBucket - the index into the bucket array
      entryPrev - the Entry object immediately preceding the Entry that was found, or null
      entryCur - the Entry object that was found
      Returns:
      an opaque result value
    • invokeNotFound

      Object invokeNotFound(Object oKey, Object oContext, SegmentedHashMap.Entry[] aeBucket, int nBucket)
      Invoke some action, holding the segment lock, when no matching Entry is found.
      Parameters:
      oKey - the key to which the action is applied
      oContext - opaque context specific to the action
      aeBucket - the bucket array
      nBucket - the index into the bucket array
      Returns:
      an opaque result value