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
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intDeprecated.static final Stringstatic final Stringprotected booleanstatic final Stringprotected Stringprotected static final Randomstatic final StringFields inherited from class org.nuxeo.runtime.model.DefaultComponent
lastModified, name -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintThe component notification order forComponent.start(ComponentContext).Returns the node id.booleanChecks if cluster mode is enabled.voidrunAtomically(String key, Duration duration, Duration pollDelay, Runnable runnable) Runs aRunnableatomically in a cluster-wide critical section, outside a transaction.voidAllows tests to set the node id without a reload.voidstart(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_SERVICEinsteadVery 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:ComponentThe 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:
getApplicationStartedOrderin interfaceComponent- Returns:
- the order, 1000 by default
-
start
Description copied from interface:ComponentStart the component. This method is called after all the components were resolved and activated- Specified by:
startin interfaceComponent- Overrides:
startin classDefaultComponent
-
isEnabled
public boolean isEnabled()Description copied from interface:ClusterServiceChecks if cluster mode is enabled.- Specified by:
isEnabledin interfaceClusterService- Returns:
trueif cluster mode is enabled,falseif not
-
getNodeId
Description copied from interface:ClusterServiceReturns the node id. This is nevernull.- Specified by:
getNodeIdin interfaceClusterService- Returns:
- the node id
-
setNodeId
Allows tests to set the node id without a reload. -
runAtomically
Description copied from interface:ClusterServiceRuns aRunnableatomically in a cluster-wide critical section, outside a transaction.- Specified by:
runAtomicallyin 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_SERVICEinstead