public class PingPongProtocolTask extends PingPongServer
This example waits for numPings ping-pongs form any node in a specified set of nodes. Note that it does not wait for numPings ping-pongs from *all* nodes in the set.
| Modifier and Type | Field and Description |
|---|---|
static int |
MAX_PINGS
Max number of pings in PingPong example.
|
myID| Constructor and Description |
|---|
PingPongProtocolTask(int id,
java.util.Set<java.lang.Integer> nodes,
int numPings) |
| Modifier and Type | Method and Description |
|---|---|
java.lang.String |
getKey()
Start of overridden methods
|
MessagingTask[] |
handleEvent(ProtocolEvent<PingPongPacket.PacketType,java.lang.String> event,
ProtocolTask<java.lang.Integer,PingPongPacket.PacketType,java.lang.String>[] ptasks)
The action handling the event may return messaging tasks that will be
automatically handled by this interface.
|
java.lang.String |
refreshKey() |
MessagingTask[] |
start()
Actions executed in the beginning.
|
getEventTypespublic static final int MAX_PINGS
public PingPongProtocolTask(int id,
java.util.Set<java.lang.Integer> nodes,
int numPings)
id - nodes - numPings - public java.lang.String getKey()
getKey in interface Keyable<java.lang.String>getKey in class PingPongServerpublic java.lang.String refreshKey()
refreshKey in class PingPongServerpublic MessagingTask[] handleEvent(ProtocolEvent<PingPongPacket.PacketType,java.lang.String> event, ProtocolTask<java.lang.Integer,PingPongPacket.PacketType,java.lang.String>[] ptasks)
ProtocolTaskhandleEvent in interface ProtocolTask<java.lang.Integer,PingPongPacket.PacketType,java.lang.String>handleEvent in class PingPongServerpublic MessagingTask[] start()
ProtocolTaskstart in interface ProtocolTask<java.lang.Integer,PingPongPacket.PacketType,java.lang.String>start in class PingPongServer