Class CaffeineDistributedService

java.lang.Object
com.axelor.cache.caffeine.CaffeineDistributedService
All Implemented Interfaces:
DistributedService

public class CaffeineDistributedService extends Object implements DistributedService
  • Constructor Details

    • CaffeineDistributedService

      public CaffeineDistributedService()
  • Method Details

    • getLock

      public Lock getLock(String name)
      Description copied from interface: DistributedService
      Returns general-purpose distributed-aware lock.
      Specified by:
      getLock in interface DistributedService
      Parameters:
      name - name of the lock
      Returns:
      distributed-aware reentrant lock
    • getLockIfDistributed

      public Lock getLockIfDistributed(String name)
      Description copied from interface: DistributedService
      Returns a lock that locks only when the cache is distributed.

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

      Specified by:
      getLockIfDistributed in interface DistributedService
      Parameters:
      name - name of the lock
      Returns:
      distributed reentrant lock or no-op lock if cache is not distributed
    • getAtomicLong

      public DistributedAtomicLong getAtomicLong(String name)
      Description copied from interface: DistributedService
      Returns distributed-aware atomic long.
      Specified by:
      getAtomicLong in interface DistributedService
      Parameters:
      name -
      Returns:
      distributed-aware atomic long