Enum Class EmptyRaftManager
- All Implemented Interfaces:
Serializable, Comparable<EmptyRaftManager>, Constable, org.infinispan.commons.api.Lifecycle, RaftManager
A NO-OP implementation of
RaftManager.
This implementation is used when RAFT is not supported by the Transport.
- Since:
- 14.0
-
Nested Class Summary
Nested classes/interfaces inherited from class Enum
Enum.EnumDesc<E> -
Enum Constant Summary
Enum Constants -
Method Summary
Modifier and TypeMethodDescriptionAdds a new member to the RAFT cluster through consensus.<T extends RaftStateMachine>
TgetOrRegisterStateMachine(String channelName, Supplier<T> supplier, RaftChannelConfiguration configuration) Register aRaftStateMachine.booleanCheck if a RAFT leader is elected for theRaftStateMachinewith namechannelName.booleanraftId()The actual members in the cluster.removeMembers(String raftId) Removes an existing member of the RAFT cluster through consensus.voidstart()voidstop()static EmptyRaftManagerReturns the enum constant of this class with the specified name.static EmptyRaftManager[]values()Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
INSTANCE
-
-
Method Details
-
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
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 nameNullPointerException- if the argument is null
-
getOrRegisterStateMachine
public <T extends RaftStateMachine> T getOrRegisterStateMachine(String channelName, Supplier<T> supplier, RaftChannelConfiguration configuration) Description copied from interface:RaftManagerRegister aRaftStateMachine.If the RAFT protocol is not supported, this method return
null. If aRaftStateMachinealready exists with namechannelName, the existing instance is returned.If
RaftManager.isRaftAvailable()returnfalse, this method always returnsnull.- Specified by:
getOrRegisterStateMachinein interfaceRaftManager- Type Parameters:
T- The concreteRaftStateMachineimplementation.- Parameters:
channelName- The name identifying theRaftStateMachine.supplier- The factory to create a new instance ofRaftStateMachine.configuration- TheRaftChannelConfigurationfor theRaftChannel.- Returns:
- The
RaftStateMachineinstance ofnullif unable to create or configure theRaftChannel.
-
isRaftAvailable
public boolean isRaftAvailable()- Specified by:
isRaftAvailablein interfaceRaftManager- Returns:
trueif the RAFT protocol is available to be used,falseotherwise.
-
hasLeader
Description copied from interface:RaftManagerCheck if a RAFT leader is elected for theRaftStateMachinewith namechannelName.- Specified by:
hasLeaderin interfaceRaftManager- Parameters:
channelName- The name identifying theRaftStateMachine.- Returns:
trueif the leader exists,falseotherwise.
-
raftId
- Specified by:
raftIdin interfaceRaftManager- Returns:
- This node raft-id.
-
addMember
Description copied from interface:RaftManagerAdds a new member to the RAFT cluster through consensus.All registered
RaftStateMachineare updated with the new membership. Warning: This method is not atomic, the membership might diverge because of failures.- Specified by:
addMemberin interfaceRaftManager- Parameters:
raftId- : A unique name of the new node joining.- Returns:
- A
CompletionStagethat finishes after the operation is applied.
-
removeMembers
Description copied from interface:RaftManagerRemoves an existing member of the RAFT cluster through consensus.All registered
RaftStateMachineare updated with the new membership. Warning: This method is not atomic, the membership might diverge because of failures.- Specified by:
removeMembersin interfaceRaftManager- Parameters:
raftId- : The node name to remove.- Returns:
- A
CompletionStagethat finishes after the operation is applied.
-
raftMembers
Description copied from interface:RaftManagerThe actual members in the cluster.- Specified by:
raftMembersin interfaceRaftManager- Returns:
- An unmodifiable list containing the IDs of all cluster members.
-
start
public void start()- Specified by:
startin interfaceorg.infinispan.commons.api.Lifecycle
-
stop
public void stop()- Specified by:
stopin interfaceorg.infinispan.commons.api.Lifecycle
-