Package org.jgroups.raft.testfwk
Class PartitionedRaftCluster
java.lang.Object
org.jgroups.raft.testfwk.MockRaftCluster
org.jgroups.raft.testfwk.PartitionedRaftCluster
Manipulate the cluster during tests.
This class offers the possibility of creating partitions in the cluster. The partitions are created by view updates.
- Since:
- 1.0.12
- Author:
- José Bolina
-
Field Summary
FieldsModifier and TypeFieldDescriptionFields inherited from class org.jgroups.raft.testfwk.MockRaftCluster
async, interceptor, thread_pool -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription<T extends MockRaftCluster>
TAdd a new member to the cluster.<T extends MockRaftCluster>
Tclear()Remove all members from the cluster.voidhandleView(org.jgroups.View view) Emit the view update to all cluster members.<T extends MockRaftCluster>
Tremove(org.jgroups.Address addr) Remove a member from the cluster.voidsend(org.jgroups.Message msg) Send a message in the cluster.intsize()The number of member in the cluster.Methods inherited from class org.jgroups.raft.testfwk.MockRaftCluster
addCommandInterceptor, async, async, createThreadPool, deliverAsync, self
-
Field Details
-
partitions
-
nodes
-
-
Constructor Details
-
PartitionedRaftCluster
public PartitionedRaftCluster()
-
-
Method Details
-
clear
Description copied from class:MockRaftClusterRemove all members from the cluster.- Specified by:
clearin classMockRaftCluster- Type Parameters:
T- : The current instance type.- Returns:
- The fluent current class.
-
add
Description copied from class:MockRaftClusterAdd a new member to the cluster.The new member is associated with the given address. A member is resolved by the address when sending a message. Also, note that a view update is necessary to propagate the member addition.
- Specified by:
addin classMockRaftCluster- Type Parameters:
T- : The current instance type.- Parameters:
addr- : The new member's address.node- : The member abstraction wrapped inRaftNode.- Returns:
- The fluent current class.
-
handleView
public void handleView(org.jgroups.View view) Description copied from class:MockRaftClusterEmit the view update to all cluster members.How the view is updated might vary from implementation. The basic idea is to iterate over all members and invoke each protocol in the stack to handle the view.
- Specified by:
handleViewin classMockRaftCluster- Parameters:
view- : The newViewinstance to update the member.
-
send
public void send(org.jgroups.Message msg) Description copied from class:MockRaftClusterSend a message in the cluster.- Specified by:
sendin classMockRaftCluster- Parameters:
msg- : Message to send.
-
size
public int size()Description copied from class:MockRaftClusterThe number of member in the cluster.- Specified by:
sizein classMockRaftCluster- Returns:
- The size of the cluster.
-
remove
Description copied from class:MockRaftClusterRemove a member from the cluster.A view update is necessary to propagate the member removal.
- Specified by:
removein classMockRaftCluster- Type Parameters:
T- : The current instance type.- Parameters:
addr- : The address of the member to remove.- Returns:
- The fluent current class.
-