Enum Class EmptyRaftManager

java.lang.Object
java.lang.Enum<EmptyRaftManager>
org.infinispan.remoting.transport.impl.EmptyRaftManager
All Implemented Interfaces:
Serializable, Comparable<EmptyRaftManager>, Constable, org.infinispan.commons.api.Lifecycle, RaftManager

public enum EmptyRaftManager extends Enum<EmptyRaftManager> implements RaftManager
A NO-OP implementation of RaftManager.

This implementation is used when RAFT is not supported by the Transport.

Since:
14.0
  • Enum Constant Details

  • Method Details

    • values

      public static EmptyRaftManager[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static EmptyRaftManager valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null
    • getOrRegisterStateMachine

      public <T extends RaftStateMachine> T getOrRegisterStateMachine(String channelName, Supplier<T> supplier, RaftChannelConfiguration configuration)
      Description copied from interface: RaftManager
      Register a RaftStateMachine.

      If the RAFT protocol is not supported, this method return null. If a RaftStateMachine already exists with name channelName, the existing instance is returned.

      If RaftManager.isRaftAvailable() return false, this method always returns null.

      Specified by:
      getOrRegisterStateMachine in interface RaftManager
      Type Parameters:
      T - The concrete RaftStateMachine implementation.
      Parameters:
      channelName - The name identifying the RaftStateMachine.
      supplier - The factory to create a new instance of RaftStateMachine.
      configuration - The RaftChannelConfiguration for the RaftChannel.
      Returns:
      The RaftStateMachine instance of null if unable to create or configure the RaftChannel.
    • isRaftAvailable

      public boolean isRaftAvailable()
      Specified by:
      isRaftAvailable in interface RaftManager
      Returns:
      true if the RAFT protocol is available to be used, false otherwise.
    • hasLeader

      public boolean hasLeader(String channelName)
      Description copied from interface: RaftManager
      Check if a RAFT leader is elected for the RaftStateMachine with name channelName.
      Specified by:
      hasLeader in interface RaftManager
      Parameters:
      channelName - The name identifying the RaftStateMachine.
      Returns:
      true if the leader exists, false otherwise.
    • raftId

      public String raftId()
      Specified by:
      raftId in interface RaftManager
      Returns:
      This node raft-id.
    • start

      public void start()
      Specified by:
      start in interface org.infinispan.commons.api.Lifecycle
    • stop

      public void stop()
      Specified by:
      stop in interface org.infinispan.commons.api.Lifecycle