Options
All
  • Public
  • Public/Protected
  • All
Menu

Class ConditionalPutAll<K, V>

/** ConditionalPutAll is an EntryProcessor that performs an update operation for multiple entries that satisfy the specified condition.

This allows for concurrent insertion/update of values within the cache. For example a concurrent replaceAll(map) could be implemented as:

  filter = PresentFilter.INSTANCE;
  cache.invokeAll(map.keys(), new ConditionalPutAll(filter, map));

or putAllIfAbsent could be done by inverting the filter:

  filter = new NotFilter(PresentFilter.INSTANCE);

Obviously, using more specific, fine-tuned filters may provide additional flexibility and efficiency allowing the multi-put operations to be performed conditionally on values of specific attributes (or even calculations) instead of a simple existence check.

Type parameters

  • K = any

  • V = any

Hierarchy

Implements

Index

Constructors

Properties

Methods

Constructors

constructor

  • Construct a ConditionalPutAll processor that updates an entry with a new value if and only if the filter applied to the entry evaluates to true. The new value is extracted from the specified map based on the entry's key.

    Parameters

    • filter: Filter

      the filter to evaluate all supplied entries

    • map: Map<K, V>

      a map of values to update entries with

    Returns ConditionalPutAll

Properties

@class

@class: string

entries

entries: MapHolder<K, V>

Specifies the new value to update an entry with.

filter

filter: Filter

The underlying filter.

Methods

andThen

when

  • Returns a ConditionalProcessor comprised of this processor and the provided filter.

    The specified entry processor gets invoked if and only if the filter applied to the entry evaluates to true; otherwise the result of the invocation will return null.

    Parameters

    Returns EntryProcessor<K, V, V>