public class EchoClientHandler extends AbstractStreamHandler
Modifier and Type | Method and Description |
---|---|
void |
event(SessionEvent event)
Called to notify about a change of the associated session state.
|
void |
exception(Throwable e)
Called to notify about an exception caught during processing of I/O or
protocol related operations.
|
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.
|
boolean |
incident(SessionIncident incident,
Throwable t)
Called to notify about an incident that occurred during processing of I/O
or protocol related operations.
|
void |
read(ByteBuffer 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.
|
available, available, getSession, setSession
event, getName, read, timer, timer
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
read
public void read(ByteBuffer data)
AbstractHandler
ByteBuffer
objects or when the associated
session is configured to optimize data copying and uses an allocator
supporting the releasing of no longer used buffers
The passed byte buffer can be safely stored or modified by this method as it will not be used by the caller. However, if the associated session is configured to optimize data copying and uses an allocator supporting the releasing of no longer used buffers it may be required to release it in this method unless the original buffer has been already released by one of the associated decoders.
By default it simply passes the data
value to the
IHandler.read(Object)
method.
read
in interface IHandler
read
in interface IStreamReader
read
in class AbstractHandler
data
- bytes that was read from the input buffer.public void read(Object msg)
IHandler
byte[]
and ByteBuffer
.msg
- the message that was read and decoded from the input buffer.public void event(SessionEvent event)
IHandler
event
in interface IHandler
event
in class AbstractHandler
event
- an event related with the change of the session stateSessionEvent
public void exception(Throwable e)
IHandler
exception
in interface IHandler
exception
in class AbstractHandler
e
- the exception caughtpublic boolean incident(SessionIncident incident, Throwable t)
IHandler
incident
in interface IHandler
incident
in class AbstractHandler
incident
- an incident that occurredt
- an exception that is related with the incident or
null
true
to indicate that the incident was handled and
the default action should not be executed by the SNF4J framework
underneath.public ISessionConfig getConfig()
IHandler
getConfig
in interface IHandler
getConfig
in class AbstractHandler
ISessionConfig
public ISessionStructureFactory getFactory()
IHandler
getFactory
in interface IHandler
getFactory
in class AbstractHandler
ISessionStructureFactory
Copyright © 2017–2022 SNF4J.ORG. All rights reserved.