Show Table of Contents
29.6. Distributed Execution and Locality
In a Distributed Environment ownership, in regards to the
DistributionManager and ConsistentHash, is theoretical; neither of these classes have any knowledge if data is actively in the cache. Instead, these classes are used to determine which node should store the specified key.
To examine the locality of a given key use either of the following options:
- Option 1: Confirm that the key is both found in the cache and the
DistributionManagerindicates it is local, as seen in the following example:(cache.getAdvancedCache().withFlags(SKIP_REMOTE_LOOKUP).containsKey(key) && cache.getAdvancedCache().getDistributionManager().getLocality(key).isLocal())
- Option 2: Query the
DataContainerdirectly:cache.getAdvancedCache().getDataContainer().containsKey(key)
Note
If the entry is passivated then theDataContainerwill returnFalse, regardless of the key's presence.

Where did the comment section go?
Red Hat's documentation publication system recently went through an upgrade to enable speedier, more mobile-friendly content. We decided to re-evaluate our commenting platform to ensure that it meets your expectations and serves as an optimal feedback mechanism. During this redesign, we invite your input on providing feedback on Red Hat documentation via the discussion platform.