Package com.axelor.cache
Class DistributedFactory
java.lang.Object
com.axelor.cache.DistributedFactory
-
Method Summary
Modifier and TypeMethodDescriptionstatic DistributedAtomicLong
getAtomicLong
(String name) Returns distributed-aware atomic long.static Lock
Returns general-purpose distributed-aware lock.static Lock
getLockIfDistributed
(String name) Returns a lock that locks only when the cache is distributed.
-
Method Details
-
getLock
Returns general-purpose distributed-aware lock.- Parameters:
name
- name of the lock- Returns:
- distributed-aware reentrant lock
-
getLockIfDistributed
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
Returns distributed-aware atomic long.- Parameters:
name
-- Returns:
- distributed-aware atomic long
-