Package com.axelor.cache
Class DistributedFactory
java.lang.Object
com.axelor.cache.DistributedFactory
-
Method Summary
Modifier and TypeMethodDescriptionstatic DistributedAtomicLonggetAtomicLong(String name) Returns distributed-aware atomic long.static LockReturns general-purpose distributed-aware lock.static LockgetLockIfDistributed(String name) Returns a lock that locks only when the cache is distributed.static AxelorTopicReturns a distributed publish/subscribe topic.
-
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
-
getTopic
Returns a distributed publish/subscribe topic.The caller class is used together with the specified name as topic name.
This is not scoped by tenant. Instead, publishers send current tenant identifier which is applied before calling listeners.
- Parameters:
name- name of the topic- Returns:
- distributed topic, or a local in-process topic if the cache is not distributed
-