16.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 DistributionManager indicates it is local, as seen in the following example:
    (cache.getAdvancedCache().withFlags(SKIP_REMOTE_LOOKUP).containsKey(key) 
    && cache.getAdvancedCache().getDistributionManager().getLocality(key).isLocal())
    Copy to Clipboard Toggle word wrap
  • Option 2: Query the DataContainer directly:
    cache.getAdvancedCache().getDataContainer().containsKey(key)
    Copy to Clipboard Toggle word wrap

    Note

    If the entry is passivated then the DataContainer will return False, regardless of the key's presence.
Back to top
Red Hat logoGithubredditYoutubeTwitter

Learn

Try, buy, & sell

Communities

About Red Hat Documentation

We help Red Hat users innovate and achieve their goals with our products and services with content they can trust. Explore our recent updates.

Making open source more inclusive

Red Hat is committed to replacing problematic language in our code, documentation, and web properties. For more details, see the Red Hat Blog.

About Red Hat

We deliver hardened solutions that make it easier for enterprises to work across platforms and environments, from the core datacenter to the network edge.

Theme

© 2025 Red Hat