Class TcpPingInterceptor
- java.lang.Object
- 
- org.apache.catalina.tribes.group.ChannelInterceptorBase
- 
- org.apache.catalina.tribes.group.interceptors.TcpPingInterceptor
 
 
- 
- All Implemented Interfaces:
- ChannelInterceptor,- TcpPingInterceptorMBean,- Heartbeat,- MembershipListener
 
 public class TcpPingInterceptor extends ChannelInterceptorBase implements TcpPingInterceptorMBean Sends a ping to all members. Configure this interceptor with the TcpFailureDetector below it, and the TcpFailureDetector will act as the membership guide.
- 
- 
Nested Class SummaryNested Classes Modifier and Type Class Description protected classTcpPingInterceptor.PingThread- 
Nested classes/interfaces inherited from interface org.apache.catalina.tribes.ChannelInterceptorChannelInterceptor.InterceptorEvent
 
- 
 - 
Field SummaryFields Modifier and Type Field Description protected static java.util.concurrent.atomic.AtomicIntegercntprotected longintervalprotected booleanrunningprotected static StringManagersmprotected booleanstaticOnlyprotected static byte[]TCP_PING_DATAprotected TcpPingInterceptor.PingThreadthreadprotected booleanuseThread- 
Fields inherited from class org.apache.catalina.tribes.group.ChannelInterceptorBaseoptionFlag
 
- 
 - 
Constructor SummaryConstructors Constructor Description TcpPingInterceptor()
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description longgetInterval()booleangetStaticOnly()booleangetUseThread()voidheartbeat()Theheartbeat()method gets invoked periodically to allow interceptors to clean up resources, time out object and perform actions that are unrelated to sending/receiving data.voidmessageReceived(ChannelMessage msg)themessageReceivedis invoked when a message is received.protected voidsendPing()protected voidsendPingMessage(Member[] members)voidsetInterval(long interval)voidsetStaticOnly(boolean staticOnly)voidsetUseThread(boolean useThread)voidstart(int svc)Starts up the channel.voidstop(int svc)Shuts down the channel.- 
Methods inherited from class org.apache.catalina.tribes.group.ChannelInterceptorBasefireInterceptorEvent, getChannel, getLocalMember, getMember, getMembers, getNext, getOptionFlag, getPrevious, hasMembers, memberAdded, memberDisappeared, okToProcess, sendMessage, setChannel, setNext, setOptionFlag, setPrevious
 - 
Methods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 - 
Methods inherited from interface org.apache.catalina.tribes.group.interceptors.TcpPingInterceptorMBeangetOptionFlag
 
- 
 
- 
- 
- 
Field Detail- 
smprotected static final StringManager sm 
 - 
TCP_PING_DATAprotected static final byte[] TCP_PING_DATA 
 - 
intervalprotected long interval 
 - 
useThreadprotected boolean useThread 
 - 
staticOnlyprotected boolean staticOnly 
 - 
runningprotected volatile boolean running 
 - 
threadprotected TcpPingInterceptor.PingThread thread 
 - 
cntprotected static final java.util.concurrent.atomic.AtomicInteger cnt 
 
- 
 - 
Method Detail- 
startpublic void start(int svc) throws ChannelExceptionDescription copied from class:ChannelInterceptorBaseStarts up the channel. This can be called multiple times for individual services to start The svc parameter can be the logical or value of any constants- Specified by:
- startin interface- ChannelInterceptor
- Overrides:
- startin class- ChannelInterceptorBase
- Parameters:
- svc- int value of
 DEFAULT - will start all services
 MBR_RX_SEQ - starts the membership receiver
 MBR_TX_SEQ - starts the membership broadcaster
 SND_TX_SEQ - starts the replication transmitter
 SND_RX_SEQ - starts the replication receiver
- Throws:
- ChannelException- if a startup error occurs or the service is already started.
- See Also:
- Channel
 
 - 
stoppublic void stop(int svc) throws ChannelExceptionDescription copied from class:ChannelInterceptorBaseShuts down the channel. This can be called multiple times for individual services to shutdown The svc parameter can be the logical or value of any constants- Specified by:
- stopin interface- ChannelInterceptor
- Overrides:
- stopin class- ChannelInterceptorBase
- Parameters:
- svc- int value of
 DEFAULT - will shutdown all services
 MBR_RX_SEQ - stops the membership receiver
 MBR_TX_SEQ - stops the membership broadcaster
 SND_TX_SEQ - stops the replication transmitter
 SND_RX_SEQ - stops the replication receiver
- Throws:
- ChannelException- if a startup error occurs or the service is already started.
- See Also:
- Channel
 
 - 
heartbeatpublic void heartbeat() Description copied from interface:ChannelInterceptorTheheartbeat()method gets invoked periodically to allow interceptors to clean up resources, time out object and perform actions that are unrelated to sending/receiving data.- Specified by:
- heartbeatin interface- ChannelInterceptor
- Specified by:
- heartbeatin interface- Heartbeat
- Overrides:
- heartbeatin class- ChannelInterceptorBase
 
 - 
getIntervalpublic long getInterval() - Specified by:
- getIntervalin interface- TcpPingInterceptorMBean
 
 - 
setIntervalpublic void setInterval(long interval) 
 - 
setUseThreadpublic void setUseThread(boolean useThread) 
 - 
setStaticOnlypublic void setStaticOnly(boolean staticOnly) 
 - 
getUseThreadpublic boolean getUseThread() - Specified by:
- getUseThreadin interface- TcpPingInterceptorMBean
 
 - 
getStaticOnlypublic boolean getStaticOnly() 
 - 
sendPingprotected void sendPing() 
 - 
sendPingMessageprotected void sendPingMessage(Member[] members) 
 - 
messageReceivedpublic void messageReceived(ChannelMessage msg) Description copied from interface:ChannelInterceptorthemessageReceivedis invoked when a message is received.ChannelMessage.getAddress()is the sender, or the reply-to address if it has been overwritten.- Specified by:
- messageReceivedin interface- ChannelInterceptor
- Overrides:
- messageReceivedin class- ChannelInterceptorBase
- Parameters:
- msg- ChannelMessage
 
 
- 
 
-