public class HeartbeatHandler extends AbstractDatagramHandler
| Constructor and Description |
|---|
HeartbeatHandler(ITimer timer,
long beatPeriod,
long downPeriod) |
HeartbeatHandler(SocketAddress remoteAddress,
ITimer timer,
long beatPeriod,
long downPeriod) |
| Modifier and Type | Method and Description |
|---|---|
void |
event(SessionEvent event)
Called to notify about a change of the associated session state.
|
ISessionConfig |
getConfig()
Returns the configuration object that will be used to configure the
behavior of the associated session.
|
ISessionStructureFactory |
getFactory()
Returns the factory object that will be used to configure the internal
structure of the associated session.
|
void |
read(byte[] data)
Called when new bytes were read from the input buffer.
|
void |
read(Object msg)
Called when a new message was read and decoded from the input buffer.
|
void |
read(SocketAddress remoteAddress,
byte[] datagram)
Called when a new datagram was received from a remote end that is identified
by the given remote address.
|
void |
read(SocketAddress remoteAddress,
Object msg)
Called when a new message was received and decoded from a remote end
that is identified by the given remote address.
|
void |
timer(Runnable task)
Called to notify about an expiration of the timer associated with the
specified task.
|
event, getSession, read, setSessionevent, exception, getName, incident, read, timerclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitevent, exception, getName, incident, read, timerreadpublic HeartbeatHandler(ITimer timer, long beatPeriod, long downPeriod)
public HeartbeatHandler(SocketAddress remoteAddress, ITimer timer, long beatPeriod, long downPeriod)
public void read(byte[] data)
AbstractHandlerread methods are
met.
The passed array can be safely stored or modified by this method as it will not be used by the caller.
By default it simply passes the data value to the
IHandler.read(Object) method.
read in interface IHandlerread in interface IDatagramReaderread in class AbstractHandlerdata - bytes that was read from the input buffer.public void read(SocketAddress remoteAddress, byte[] datagram)
AbstractDatagramHandler
This method is called when none of the conditions for calling other
read methods with specified remote address are met.
The passed array can be safely stored or modified by this method as it will not be used by the caller.
By default it simply passes the remoteAddress and data values
to the IDatagramHandler.read(SocketAddress,Object) method.
read in interface IDatagramHandlerread in interface IDatagramReaderread in class AbstractDatagramHandlerremoteAddress - address of the remote end.datagram - the datagram received from the remote end.public void read(Object msg)
IHandlerbyte[] and ByteBuffer.msg - the message that was read and decoded from the input buffer.public void read(SocketAddress remoteAddress, Object msg)
IDatagramHandlerbyte[] and ByteBuffer.
The method is only called for sessions created with a disconnected datagram channel.
remoteAddress - address of the remote end.msg - the message received from the remote end.public void event(SessionEvent event)
IHandlerevent in interface IHandlerevent in class AbstractHandlerevent - an event related with the change of the session stateSessionEventpublic void timer(Runnable task)
IHandlertimer in interface IHandlertimer in class AbstractHandlertask - the task to executepublic ISessionConfig getConfig()
IHandlergetConfig in interface IHandlergetConfig in class AbstractHandlerISessionConfigpublic ISessionStructureFactory getFactory()
IHandlergetFactory in interface IHandlergetFactory in class AbstractHandlerISessionStructureFactoryCopyright © 2017–2022 SNF4J.ORG. All rights reserved.