NodeIDType
- A generic type for representing node identifiers. It must support
an explicitly overridden toString() method that converts
NodeIDType to String, and the NodeConfig object supplied to this
class' constructor must support a valueOf(String) method that
returns back the original NodeIDType. Thus, even though NodeIDType
is generic, a one-to-one mapping between NodeIDType and String is
necessary.public abstract class ReconfigurableNode<NodeIDType>
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
ReconfigurableNode.DefaultReconfigurableNode |
Modifier and Type | Field and Description |
---|---|
protected JSONMessenger<NodeIDType> |
messenger |
protected NodeIDType |
myID |
protected ReconfigurableNodeConfig<NodeIDType> |
nodeConfig |
Constructor and Description |
---|
ReconfigurableNode(NodeIDType id,
ReconfigurableNodeConfig<NodeIDType> nodeConfig) |
ReconfigurableNode(NodeIDType id,
ReconfigurableNodeConfig<NodeIDType> nodeConfig,
java.lang.String[] args,
boolean startCleanSlate) |
Modifier and Type | Method and Description |
---|---|
void |
close()
Close gracefully.
|
protected abstract AbstractReplicaCoordinator<NodeIDType> |
createAppCoordinator() |
static void |
forceClear(java.lang.String server)
For testing.
|
java.lang.String |
getMyID() |
static void |
main(java.lang.String[] args)
args contains a list of app arguments followed by a list of
active or reconfigurator node IDs at the end. |
static void |
stopServer(java.lang.String server) |
java.lang.String |
toString() |
protected final NodeIDType myID
protected final ReconfigurableNodeConfig<NodeIDType> nodeConfig
protected final JSONMessenger<NodeIDType> messenger
public ReconfigurableNode(NodeIDType id, ReconfigurableNodeConfig<NodeIDType> nodeConfig) throws java.io.IOException
id
- nodeConfig
- java.io.IOException
public ReconfigurableNode(NodeIDType id, ReconfigurableNodeConfig<NodeIDType> nodeConfig, java.lang.String[] args, boolean startCleanSlate) throws java.io.IOException
id
- Node ID of this ReconfigurableNode being created.nodeConfig
- Maps node IDs of active replicas and reconfigurators to their
socket addresses.args
- startCleanSlate
- Used to join newly added nodes.java.io.IOException
- Thrown if networking functions can not be successfully
initialized. A common reason for this exception is that the
socket addresses corresponding to the supplied 'id' argument
are not local, i.e., the node with this id should not be
created on this machine in the first place, or if the id is
not present at all in the supplied 'nodeConfig' argument.protected abstract AbstractReplicaCoordinator<NodeIDType> createAppCoordinator()
public void close()
public static void forceClear(java.lang.String server)
server
- public static void stopServer(java.lang.String server)
server
- public java.lang.String toString()
toString
in class java.lang.Object
public java.lang.String getMyID()
public static void main(java.lang.String[] args) throws java.io.IOException
args
contains a list of app arguments followed by a list of
active or reconfigurator node IDs at the end. The string "start all" is
accepted as a proxy for the list of all nodes if the socket addresses of
all nodes are on the local machine.args
- java.io.IOException