Interface DistributedService

All Known Implementing Classes:
CaffeineDistributedService, RedissonDistributedService

public interface DistributedService
Service for getting distributed-aware objects.
  • Method Details

    • getLock

      Lock getLock(String name)
      Returns general-purpose distributed-aware lock.
      Parameters:
      name - name of the lock
      Returns:
      distributed-aware reentrant lock
    • getLockIfDistributed

      default Lock getLockIfDistributed(String name)
      Returns a lock that locks only when the cache is distributed.

      This is useful when no locking is needed in single-instance setup.

      Parameters:
      name - name of the lock
      Returns:
      distributed reentrant lock or no-op lock if cache is not distributed
    • getAtomicLong

      DistributedAtomicLong getAtomicLong(String name)
      Returns distributed-aware atomic long.
      Parameters:
      name -
      Returns:
      distributed-aware atomic long