public interface IHandler
Modifier and Type | Method and Description |
---|---|
void |
event(DataEvent event,
long length)
Called to notify about an I/O operation.
|
void |
event(SessionEvent event)
Called to notify about a change of the associated session state.
|
void |
exception(Throwable t)
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.
|
String |
getName()
Returns the name of the handler.
|
ISession |
getSession()
Returns the session that is associated with this handler.
|
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(byte[] data)
Called when new bytes were read from the input buffer.
|
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.
|
void |
setSession(ISession session)
Sets the session that will be associated with this handler.
|
void |
timer(Object event)
Called to notify about an expiration of the timer identified by the
specified event object.
|
void |
timer(Runnable task)
Called to notify about an expiration of the timer associated with the
specified task.
|
void setSession(ISession session)
session
- the sessionISession getSession()
String getName()
null
if the name is not specified.void read(byte[] data)
read
methods are
met.
The passed array can be safely stored or modified by this method as it will not be used by the caller.
data
- bytes that was read from the input buffer.void read(ByteBuffer data)
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.
data
- bytes that was read from the input buffer.void read(Object msg)
byte[]
and ByteBuffer
.msg
- the message that was read and decoded from the input buffer.void event(SessionEvent event)
event
- an event related with the change of the session stateSessionEvent
void event(DataEvent event, long length)
event
- an event related with the type of I/O operationlength
- the number of bytes related with the I/O operationDataEvent
void exception(Throwable t)
t
- the exception caughtboolean incident(SessionIncident incident, Throwable t)
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.void timer(Object event)
event
- the event object that identifies the timervoid timer(Runnable task)
task
- the task to executeISessionStructureFactory getFactory()
ISessionStructureFactory
ISessionConfig getConfig()
ISessionConfig
Copyright © 2017–2022 SNF4J.ORG. All rights reserved.