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:DistributedService
Returns general-purpose distributed-aware lock.- Specified by:
getLock
in interfaceDistributedService
- Parameters:
name
- name of the lock- Returns:
- distributed-aware reentrant lock
-
getLockIfDistributed
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 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:DistributedService
Returns distributed-aware atomic long.- Specified by:
getAtomicLong
in interfaceDistributedService
- Parameters:
name
-- Returns:
- distributed-aware atomic long
-