|
Apache Tomcat 6.0.53 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.catalina.tribes.group.ChannelInterceptorBase org.apache.catalina.tribes.group.interceptors.TcpFailureDetector
public class TcpFailureDetector
Title: A perfect failure detector
Description: The TcpFailureDetector is a useful interceptor that adds reliability to the membership layer.
If the network is busy, or the system is busy so that the membership receiver thread is not getting enough time to update its table, members can be "timed out" This failure detector will intercept the memberDisappeared message(unless its a true shutdown message) and connect to the member using TCP.
The TcpFailureDetector works in two ways.
1. It intercepts memberDisappeared events
2. It catches send errors
Nested Class Summary |
---|
Nested classes/interfaces inherited from interface org.apache.catalina.tribes.ChannelInterceptor |
---|
ChannelInterceptor.InterceptorEvent |
Field Summary | |
---|---|
protected java.util.HashMap |
addSuspects
|
protected long |
connectTimeout
|
protected Membership |
membership
|
protected boolean |
performConnectTest
|
protected boolean |
performReadTest
|
protected boolean |
performSendTest
|
protected long |
readTestTimeout
|
protected java.util.HashMap |
removeSuspects
|
protected static byte[] |
TCP_FAIL_DETECT
|
Fields inherited from class org.apache.catalina.tribes.group.ChannelInterceptorBase |
---|
optionFlag |
Constructor Summary | |
---|---|
TcpFailureDetector()
|
Method Summary | |
---|---|
void |
checkMembers(boolean checkAll)
|
long |
getConnectTimeout()
|
Member |
getLocalMember(boolean incAlive)
Return the member that represents this node. |
Member |
getMember(Member mbr)
Intercepts the code>Channel.getMember(Member) method |
Member[] |
getMembers()
Get all current cluster members |
boolean |
getPerformConnectTest()
|
boolean |
getPerformReadTest()
|
boolean |
getPerformSendTest()
|
long |
getReadTestTimeout()
|
boolean |
hasMembers()
has members |
void |
heartbeat()
The heartbeat() method gets invoked periodically
to allow interceptors to clean up resources, time out object and
perform actions that are unrelated to sending/receiving data. |
void |
memberAdded(Member member)
A member was added to the group |
protected boolean |
memberAlive(Member mbr)
|
protected static boolean |
memberAlive(Member mbr,
byte[] msgData,
boolean sendTest,
boolean readTest,
long readTimeout,
long conTimeout,
int optionFlag)
|
void |
memberDisappeared(Member member)
A member was removed from the group If the member left voluntarily, the Member.getCommand will contain the Member.SHUTDOWN_PAYLOAD data |
void |
messageReceived(ChannelMessage msg)
the messageReceived is invoked when a message is received. |
protected void |
performBasicCheck()
|
protected void |
performForcedCheck()
|
void |
sendMessage(Member[] destination,
ChannelMessage msg,
InterceptorPayload payload)
The sendMessage method is called when a message is being sent to one more destinations. |
void |
setConnectTimeout(long connectTimeout)
|
void |
setPerformConnectTest(boolean performConnectTest)
|
void |
setPerformReadTest(boolean performReadTest)
|
void |
setPerformSendTest(boolean performSendTest)
|
void |
setReadTestTimeout(long readTestTimeout)
|
protected void |
setupMembership()
|
Methods inherited from class org.apache.catalina.tribes.group.ChannelInterceptorBase |
---|
accept, fireInterceptorEvent, getNext, getOptionFlag, getPrevious, okToProcess, setNext, setOptionFlag, setPrevious, start, stop |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected static byte[] TCP_FAIL_DETECT
protected boolean performConnectTest
protected long connectTimeout
protected boolean performSendTest
protected boolean performReadTest
protected long readTestTimeout
protected Membership membership
protected java.util.HashMap removeSuspects
protected java.util.HashMap addSuspects
Constructor Detail |
---|
public TcpFailureDetector()
Method Detail |
---|
public void sendMessage(Member[] destination, ChannelMessage msg, InterceptorPayload payload) throws ChannelException
ChannelInterceptor
sendMessage
method is called when a message is being sent to one more destinations.
The interceptor can modify any of the parameters and then pass on the message down the stack by
invoking getNext().sendMessage(destination,msg,payload)
getNext().sendMessage(destination,msg,payload)
sendMessage
in interface ChannelInterceptor
sendMessage
in class ChannelInterceptorBase
destination
- Member[] - the destination for this messagemsg
- ChannelMessage - the message to be sentpayload
- InterceptorPayload - the payload, carrying an error handler and future useful data, can be null
ChannelException
ErrorHandler
,
InterceptorPayload
public void messageReceived(ChannelMessage msg)
ChannelInterceptor
messageReceived
is invoked when a message is received.
ChannelMessage.getAddress()
is the sender, or the reply-to address
if it has been overwritten.
messageReceived
in interface ChannelInterceptor
messageReceived
in class ChannelInterceptorBase
msg
- ChannelMessagepublic void memberAdded(Member member)
MembershipListener
memberAdded
in interface MembershipListener
memberAdded
in class ChannelInterceptorBase
member
- Member - the member that was addedpublic void memberDisappeared(Member member)
MembershipListener
memberDisappeared
in interface MembershipListener
memberDisappeared
in class ChannelInterceptorBase
member
- MemberMember.SHUTDOWN_PAYLOAD
public boolean hasMembers()
ChannelInterceptorBase
hasMembers
in interface ChannelInterceptor
hasMembers
in class ChannelInterceptorBase
Channel.hasMembers()
public Member[] getMembers()
ChannelInterceptorBase
getMembers
in interface ChannelInterceptor
getMembers
in class ChannelInterceptorBase
Channel.getMembers()
public Member getMember(Member mbr)
ChannelInterceptor
getMember
in interface ChannelInterceptor
getMember
in class ChannelInterceptorBase
mbr
- Member
Channel.getMember(Member)
public Member getLocalMember(boolean incAlive)
ChannelInterceptorBase
getLocalMember
in interface ChannelInterceptor
getLocalMember
in class ChannelInterceptorBase
incAlive
- boolean
Channel.getLocalMember(boolean)
public void heartbeat()
ChannelInterceptor
heartbeat()
method gets invoked periodically
to allow interceptors to clean up resources, time out object and
perform actions that are unrelated to sending/receiving data.
heartbeat
in interface ChannelInterceptor
heartbeat
in interface Heartbeat
heartbeat
in class ChannelInterceptorBase
public void checkMembers(boolean checkAll)
protected void performForcedCheck()
protected void performBasicCheck()
protected void setupMembership()
protected boolean memberAlive(Member mbr)
protected static boolean memberAlive(Member mbr, byte[] msgData, boolean sendTest, boolean readTest, long readTimeout, long conTimeout, int optionFlag)
public boolean getPerformConnectTest()
public long getReadTestTimeout()
public boolean getPerformSendTest()
public boolean getPerformReadTest()
public long getConnectTimeout()
public void setPerformConnectTest(boolean performConnectTest)
public void setPerformReadTest(boolean performReadTest)
public void setPerformSendTest(boolean performSendTest)
public void setReadTestTimeout(long readTestTimeout)
public void setConnectTimeout(long connectTimeout)
|
Apache Tomcat 6.0.53 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |