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 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

      public String getNodeId()
      Returns the id of this node, created once per JVM.
      Returns:
      node id
    • getLastAppliedSettingsId

      public @Nullable UUID 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

      public void setLastAppliedSettingsId(@Nullable UUID settingsId)
      Remembers the settings record this node applied last.
      Parameters:
      settingsId - settings record id
    • publishApplied

      public void publishApplied(UUID settingsId)
      Announces an applied model to the other nodes. Does nothing when cluster support is off.
      Parameters:
      settingsId - id of the applied settings record
    • shouldCatchUp

      public boolean shouldCatchUp(DynamicModelAppliedClusterEvent event)
      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