public class TcpPingInterceptor extends ChannelInterceptorBase
Modifier and Type | Class and Description |
---|---|
protected class |
TcpPingInterceptor.PingThread |
ChannelInterceptor.InterceptorEvent
Modifier and Type | Field and Description |
---|---|
protected static java.util.concurrent.atomic.AtomicInteger |
cnt |
protected long |
interval |
protected boolean |
running |
protected boolean |
staticOnly |
protected static byte[] |
TCP_PING_DATA |
protected TcpPingInterceptor.PingThread |
thread |
protected boolean |
useThread |
optionFlag
Constructor and Description |
---|
TcpPingInterceptor() |
Modifier and Type | Method and Description |
---|---|
long |
getInterval() |
boolean |
getStaticOnly() |
boolean |
getUseThread() |
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 |
messageReceived(ChannelMessage msg)
the
messageReceived is invoked when a message is received. |
protected void |
sendPing() |
protected void |
sendPingMessage(Member[] members) |
void |
setInterval(long interval) |
void |
setStaticOnly(boolean staticOnly) |
void |
setUseThread(boolean useThread) |
void |
start(int svc)
Starts up the channel.
|
void |
stop(int svc)
Shuts down the channel.
|
accept, fireInterceptorEvent, getLocalMember, getMember, getMembers, getNext, getOptionFlag, getPrevious, hasMembers, memberAdded, memberDisappeared, okToProcess, sendMessage, setNext, setOptionFlag, setPrevious
protected static byte[] TCP_PING_DATA
protected long interval
protected boolean useThread
protected boolean staticOnly
protected volatile boolean running
protected TcpPingInterceptor.PingThread thread
protected static java.util.concurrent.atomic.AtomicInteger cnt
public void start(int svc) throws ChannelException
ChannelInterceptorBase
start
in interface ChannelInterceptor
start
in class ChannelInterceptorBase
svc
- int value of ChannelException
- if a startup error occurs or the service is already started.Channel
public void stop(int svc) throws ChannelException
ChannelInterceptorBase
stop
in interface ChannelInterceptor
stop
in class ChannelInterceptorBase
svc
- int value of ChannelException
- if a startup error occurs or the service is already started.Channel
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 long getInterval()
public void setInterval(long interval)
public void setUseThread(boolean useThread)
public void setStaticOnly(boolean staticOnly)
public boolean getUseThread()
public boolean getStaticOnly()
protected void sendPing()
protected void sendPingMessage(Member[] members)
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
- ChannelMessageCopyright © 2000-2015 Apache Software Foundation. All Rights Reserved.