public class FD extends Protocol
FD starts when it detects (in a view change notification) that there are at least 2 members in the group. It stops running when the membership drops below 2.
When a message is received from the monitored neighbor member, it causes the pinger thread to 'skip' sending the next are-you-alive message. Thus, traffic is reduced.
When we receive a ping from a member that's not in the membership list, we shun it by sending it a
NOT_MEMBER message. That member will then leave the group (and possibly rejoin). This is only done if
shun
is true.
Modifier and Type | Class and Description |
---|---|
protected class |
FD.Broadcaster
Task that periodically broadcasts a list of suspected members to the group.
|
protected class |
FD.BroadcastTask |
static class |
FD.FdHeader |
protected class |
FD.Monitor |
Modifier and Type | Field and Description |
---|---|
protected FD.Broadcaster |
bcast_task
Transmits SUSPECT message until view change or UNSUSPECT is received
|
protected java.util.concurrent.locks.Lock |
lock |
protected int |
num_heartbeats |
protected int |
num_suspect_events |
Constructor and Description |
---|
FD() |
Modifier and Type | Method and Description |
---|---|
java.lang.Object |
down(Event evt)
An event is to be sent down the stack.
|
int |
getCurrentNumTries() |
java.lang.String |
getLocalAddress() |
int |
getMaxTries() |
java.lang.String |
getMembers() |
java.lang.String |
getName() |
int |
getNumberOfHeartbeatsSent() |
int |
getNumSuspectEventsGenerated() |
java.lang.String |
getPingableMembers() |
java.lang.String |
getPingDest() |
long |
getTimeout() |
void |
init()
Called after instance has been created (null constructor) and before protocol is started.
|
boolean |
isShun() |
java.lang.String |
printSuspectHistory() |
void |
resetStats() |
void |
setMaxTries(int max_tries) |
boolean |
setProperties(java.util.Properties props)
Configures the protocol initially.
|
void |
setShun(boolean flag) |
void |
setTimeout(long timeout) |
void |
stop()
This method is called on a
Channel.disconnect() . |
java.lang.Object |
up(Event evt)
An event was received from the layer below.
|
destroy, downThreadEnabled, dumpStats, enableStats, getDownProtocol, getProperties, getProtocolStack, getThreadFactory, getTransport, getUpProtocol, printStats, providedDownServices, providedUpServices, requiredDownServices, requiredUpServices, setDownProtocol, setPropertiesInternal, setProtocolStack, setUpProtocol, start, statsEnabled, upThreadEnabled
protected final java.util.concurrent.locks.Lock lock
protected int num_heartbeats
protected int num_suspect_events
protected final FD.Broadcaster bcast_task
public java.lang.String getLocalAddress()
public java.lang.String getMembers()
public java.lang.String getPingableMembers()
public java.lang.String getPingDest()
public int getNumberOfHeartbeatsSent()
public int getNumSuspectEventsGenerated()
public long getTimeout()
public void setTimeout(long timeout)
public int getMaxTries()
public void setMaxTries(int max_tries)
public int getCurrentNumTries()
public boolean isShun()
public void setShun(boolean flag)
public java.lang.String printSuspectHistory()
public boolean setProperties(java.util.Properties props)
Protocol
"loopback=false;unicast_inport=4444"
setProperties
in class Protocol
public void resetStats()
resetStats
in class Protocol
public void init() throws java.lang.Exception
Protocol
public void stop()
Protocol
Channel.disconnect()
. Stops work (e.g. by closing multicast socket).
Will be called from top to bottom. This means that at the time of the method invocation the
neighbor protocol below is still working. This method will replace the
STOP, STOP_OK, CLEANUP and CLEANUP_OK events. The ProtocolStack guarantees that
when this method is called all messages in the down queue will have been flushedpublic java.lang.Object up(Event evt)
Protocol
down_prot.down()
or c) the event (or another event) is sent up
the stack using up_prot.up()
.public java.lang.Object down(Event evt)
Protocol
down_prot.down()
. In case of a GET_ADDRESS event (which tries to
retrieve the stack's address from one of the bottom layers), the layer may need to send
a new response event back up the stack using up_prot.up()
.Copyright ? 1998-2008 Bela Ban. All Rights Reserved.