Parallel Method Invocations and Queries on the NamedMap

The NamedMap supports parallel method invocations and queries which are concurrently executed across all nodes in the IMDG, with each node working on its local set of keys and values. Please refer to the NamedMap documentation for more details.

Parallel method invocations are run on the map contents to produce a single result object. They have two phases: eval(…), which returns a result for each key in the map, and merge(), which performs a pairwise merge of the results. Parallel operations can have a parameter object, which is passed as a parameter to the eval(…) and merge() methods when they are invoked by the worker nodes. These parallel operations can be treated as a lightweight alternative to the MapReduce job performed on a NamedMap. Parallel method invocations are defined by subclassing NamedMapInvokable and passing the implementation, parameter object, and optional timeout to NamedMap.invoke(…).

Queries filter keys in the NamedMap based on the provided condition and return a collection of the matching keys. Queries are run by providing an implementation of the QueryCondition interface to NamedMap.executeParallelQuery(…). The sample program in the next section contains an example of query usage.

Parallel operations and queries require an IG assigned to the NamedMap. If an IG was previously constructed to run a ScaleOut hServer job, it can be reused, as in the following example.