Interface Locality

All Known Implementing Classes:
ConsistentHashLocality, SimpleLocality

public interface Locality
Facility for determining the primary ownership/location of a given cache key.
Author:
Paul Ferraro
  • Method Summary

    Modifier and Type
    Method
    Description
    static Locality
    forConsistentHash(org.infinispan.Cache<?,?> cache, org.infinispan.distribution.ch.ConsistentHash hash)
    Returns the locality for the specified consistent hash of the specified cache.
    static Locality
    forCurrentConsistentHash(org.infinispan.Cache<?,?> cache)
    Returns the locality for the current consistent hash of the specified cache.
    boolean
    Indicates whether the current node is the primary owner of the specified cache key.
    static Locality
    of(boolean local)
    Returns a locality that returns the same value for any key.
  • Method Details

    • isLocal

      boolean isLocal(Object key)
      Indicates whether the current node is the primary owner of the specified cache key. For local caches, this method will always return true.
      Parameters:
      key - a cache key
      Returns:
      true, if the current node is the primary owner of the specified cache key, false otherwise
    • of

      static Locality of(boolean local)
      Returns a locality that returns the same value for any key.
      Parameters:
      local - specifies whether or not all keys are local
      Returns:
      a locality that returns the same value for any key.
    • forCurrentConsistentHash

      static Locality forCurrentConsistentHash(org.infinispan.Cache<?,?> cache)
      Returns the locality for the current consistent hash of the specified cache.
      Parameters:
      cache - an embedded cache
      Returns:
      the locality for the current consistent hash of the specified cache.
    • forConsistentHash

      static Locality forConsistentHash(org.infinispan.Cache<?,?> cache, org.infinispan.distribution.ch.ConsistentHash hash)
      Returns the locality for the specified consistent hash of the specified cache.
      Parameters:
      cache - an embedded cache
      hash - a consistent hash
      Returns:
      the locality for the specified consistent hash of the specified cache.