Package io.jmix.dynmodel.impl.cluster
Class DynamicModelClusterSupport
java.lang.Object
io.jmix.dynmodel.impl.cluster.DynamicModelClusterSupport
@Component("dynmod_DynamicModelClusterSupport")
public class DynamicModelClusterSupport
extends Object
Holds this node's identity and the model it last applied, and sends the cluster message announcing an
applied model.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription@Nullable UUIDReturns the id of the settings record this node applied last.Returns the id of this node, created once per JVM.protected voidinit()booleanReturns whether cluster support is on.voidpublishApplied(UUID settingsId) Announces an applied model to the other nodes.voidsetLastAppliedSettingsId(@Nullable UUID settingsId) Remembers the settings record this node applied last.booleanDecides whether this node has to catch up with a model applied elsewhere.
-
Constructor Details
-
DynamicModelClusterSupport
public DynamicModelClusterSupport()
-
-
Method Details
-
init
@PostConstruct protected void init() -
isEnabled
public boolean isEnabled()Returns whether cluster support is on.- Returns:
- true if an applied model is announced to the other nodes and the apply lock is cluster-wide
-
getNodeId
Returns the id of this node, created once per JVM.- Returns:
- node id
-
getLastAppliedSettingsId
Returns the id of the settings record this node applied last.- Returns:
- settings record id, or null if nothing has been applied yet
-
setLastAppliedSettingsId
Remembers the settings record this node applied last.- Parameters:
settingsId- settings record id
-
publishApplied
Announces an applied model to the other nodes. Does nothing when cluster support is off.- Parameters:
settingsId- id of the applied settings record
-
shouldCatchUp
Decides whether this node has to catch up with a model applied elsewhere.- Parameters:
event- received event- Returns:
- true if this node has to re-apply the active model
-