Package org.nuxeo.runtime.cluster
Class ClusterServiceImpl
java.lang.Object
org.nuxeo.runtime.model.DefaultComponent
org.nuxeo.runtime.cluster.ClusterServiceImpl
- All Implemented Interfaces:
ClusterService
,Adaptable
,Component
,Extensible
,TimestampedService
Implementation for the Cluster Service.
- Since:
- 11.1
-
Nested Class Summary
-
Field Summary
Modifier and TypeFieldDescriptionstatic final int
Deprecated.static final String
static final String
protected boolean
static final String
protected String
protected static final Random
static final String
Fields inherited from class org.nuxeo.runtime.model.DefaultComponent
lastModified, name
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionint
The component notification order forComponent.start(ComponentContext)
.Returns the node id.boolean
Checks if cluster mode is enabled.void
runAtomically
(String key, Duration duration, Duration pollDelay, Runnable runnable) Runs aRunnable
atomically in a cluster-wide critical section, outside a transaction.void
Allows tests to set the node id without a reload.void
start
(ComponentContext context) Start the component.Methods inherited from class org.nuxeo.runtime.model.DefaultComponent
activate, addRuntimeMessage, addRuntimeMessage, deactivate, getAdapter, getDescriptor, getDescriptors, getLastModified, getRegistry, register, registerContribution, registerExtension, setLastModified, setModifiedNow, setName, stop, unregister, unregisterContribution, unregisterExtension
-
Field Details
-
APPLICATION_STARTED_ORDER
Deprecated.since 2023.0, useComponentStartOrders.CLUSTER_SERVICE
insteadVery early as other services depend on us.- See Also:
-
XP_CONFIG
- See Also:
-
CLUSTERING_ENABLED_OLD_PROP
- See Also:
-
NODE_ID_OLD_PROP
- See Also:
-
CAPABILITY_CLUSTER
- Since:
- 11.5
- See Also:
-
RANDOM
-
enabled
protected boolean enabled -
nodeId
-
-
Constructor Details
-
ClusterServiceImpl
public ClusterServiceImpl()
-
-
Method Details
-
getApplicationStartedOrder
public int getApplicationStartedOrder()Description copied from interface:Component
The component notification order forComponent.start(ComponentContext)
.Components are notified in increasing order. Order 1000 is the default order for components that don't care. Order 100 is the repository initialization.
- Specified by:
getApplicationStartedOrder
in interfaceComponent
- Returns:
- the order, 1000 by default
-
start
Description copied from interface:Component
Start the component. This method is called after all the components were resolved and activated- Specified by:
start
in interfaceComponent
- Overrides:
start
in classDefaultComponent
-
isEnabled
public boolean isEnabled()Description copied from interface:ClusterService
Checks if cluster mode is enabled.- Specified by:
isEnabled
in interfaceClusterService
- Returns:
true
if cluster mode is enabled,false
if not
-
getNodeId
Description copied from interface:ClusterService
Returns the node id. This is nevernull
.- Specified by:
getNodeId
in interfaceClusterService
- Returns:
- the node id
-
setNodeId
Allows tests to set the node id without a reload. -
runAtomically
Description copied from interface:ClusterService
Runs aRunnable
atomically in a cluster-wide critical section, outside a transaction.- Specified by:
runAtomically
in interfaceClusterService
- Parameters:
key
- the key used to determine atomicityduration
- the duration during which we attempt to acquire the lockpollDelay
- the delay between two subsequent polls of the lockrunnable
- the runnable
-
ComponentStartOrders.CLUSTER_SERVICE
instead