Package com.axelor.cache.caffeine
Class CaffeineDistributedService
java.lang.Object
com.axelor.cache.caffeine.CaffeineDistributedService
- All Implemented Interfaces:
DistributedService
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetAtomicLong(String name) Returns distributed-aware atomic long.Returns general-purpose distributed-aware lock.getLockIfDistributed(String name) Returns a lock that locks only when the cache is distributed.
-
Constructor Details
-
CaffeineDistributedService
public CaffeineDistributedService()
-
-
Method Details
-
getLock
Description copied from interface:DistributedServiceReturns general-purpose distributed-aware lock.- Specified by:
getLockin interfaceDistributedService- Parameters:
name- name of the lock- Returns:
- distributed-aware reentrant lock
-
getLockIfDistributed
Description copied from interface:DistributedServiceReturns a lock that locks only when the cache is distributed.This is useful when no locking is needed in single-instance setup.
- Specified by:
getLockIfDistributedin interfaceDistributedService- Parameters:
name- name of the lock- Returns:
- distributed reentrant lock or no-op lock if cache is not distributed
-
getAtomicLong
Description copied from interface:DistributedServiceReturns distributed-aware atomic long.- Specified by:
getAtomicLongin interfaceDistributedService- Parameters:
name-- Returns:
- distributed-aware atomic long
-