Package org.apache.mina.common.support
Class AbstractIoFilterChain
java.lang.Object
org.apache.mina.common.support.AbstractIoFilterChain
- All Implemented Interfaces:
IoFilterChain
- Direct Known Subclasses:
VmPipeFilterChain
An abstract implementation of
IoFilterChain
that provides
common operations for developers to implement their own transport layer.
The only method a developer should implement is
doWrite(IoSession, IoFilter.WriteRequest)
. This method is invoked
when filter chain is evaluated for
IoFilter.filterWrite(NextFilter, IoSession, IoFilter.WriteRequest)
and
finally to be written out.
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.apache.mina.common.IoFilterChain
IoFilterChain.Entry
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final String
A session attribute that stores aConnectFuture
related with theIoSession
. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
Adds the specified filter with the specified name just after the filter whose name isbaseName
in this chain.void
Adds the specified filter with the specified name just before the filter whose name isbaseName
in this chain.void
Adds the specified filter with the specified name at the beginning of this chain.void
Adds the specified filter with the specified name at the end of this chain.void
clear()
Removes all filters added to this chain.boolean
Returns true if this chain contains anIoFilter
of the specified filterType.boolean
Returns true if this chain contains anIoFilter
with the specified name.boolean
Returns true if this chain contains the specified filter.protected abstract void
protected abstract void
doWrite
(IoSession session, IoFilter.WriteRequest writeRequest) protected void
finalize()
void
fireExceptionCaught
(IoSession session, Throwable cause) Fires aIoHandler.exceptionCaught(IoSession, Throwable)
event.void
fireFilterClose
(IoSession session) Fires aIoSession.close()
event.void
fireFilterWrite
(IoSession session, IoFilter.WriteRequest writeRequest) Fires aIoSession.write(Object)
event.void
fireMessageReceived
(IoSession session, Object message) Fires aIoFilterChain.fireMessageReceived(IoSession, Object)
event.void
fireMessageSent
(IoSession session, IoFilter.WriteRequest request) Fires aIoHandler.sessionOpened(IoSession)
event.void
fireSessionClosed
(IoSession session) Fires aIoHandler.sessionClosed(IoSession)
event.void
fireSessionCreated
(IoSession session) Fires aIoHandler.sessionCreated(IoSession)
event.void
fireSessionIdle
(IoSession session, IdleStatus status) Fires aIoHandler.sessionIdle(IoSession, IdleStatus)
event.void
fireSessionOpened
(IoSession session) Fires aIoHandler.sessionOpened(IoSession)
event.Returns theIoFilter
with the specified name in this chain.getAll()
Returns the list of allIoFilterChain.Entry
s this chain contains.Returns the reversed list of allIoFilterChain.Entry
s this chain contains.Returns theIoFilterChain.Entry
with the specified name in this chain.getNextFilter
(String name) Returns theIoFilter.NextFilter
of theIoFilter
with the specified name in this chain.Returns the parentIoSession
of this chain.Removes the filter with the specified name from this chain.toString()
-
Field Details
-
CONNECT_FUTURE
A session attribute that stores aConnectFuture
related with theIoSession
.AbstractIoFilterChain
clears this attribute and notifies the future whenfireSessionOpened(IoSession)
orfireExceptionCaught(IoSession, Throwable)
is invoked
-
-
Constructor Details
-
AbstractIoFilterChain
-
-
Method Details
-
getSession
Description copied from interface:IoFilterChain
Returns the parentIoSession
of this chain.- Specified by:
getSession
in interfaceIoFilterChain
- Returns:
IoSession
-
getEntry
Description copied from interface:IoFilterChain
Returns theIoFilterChain.Entry
with the specified name in this chain.- Specified by:
getEntry
in interfaceIoFilterChain
- Returns:
- null if there's no such name in this chain
-
get
Description copied from interface:IoFilterChain
Returns theIoFilter
with the specified name in this chain.- Specified by:
get
in interfaceIoFilterChain
- Returns:
- null if there's no such name in this chain
-
getNextFilter
Description copied from interface:IoFilterChain
Returns theIoFilter.NextFilter
of theIoFilter
with the specified name in this chain.- Specified by:
getNextFilter
in interfaceIoFilterChain
- Returns:
- null if there's no such name in this chain
-
addFirst
Description copied from interface:IoFilterChain
Adds the specified filter with the specified name at the beginning of this chain.- Specified by:
addFirst
in interfaceIoFilterChain
-
addLast
Description copied from interface:IoFilterChain
Adds the specified filter with the specified name at the end of this chain.- Specified by:
addLast
in interfaceIoFilterChain
-
addBefore
Description copied from interface:IoFilterChain
Adds the specified filter with the specified name just before the filter whose name isbaseName
in this chain.- Specified by:
addBefore
in interfaceIoFilterChain
-
addAfter
Description copied from interface:IoFilterChain
Adds the specified filter with the specified name just after the filter whose name isbaseName
in this chain.- Specified by:
addAfter
in interfaceIoFilterChain
-
remove
Description copied from interface:IoFilterChain
Removes the filter with the specified name from this chain.- Specified by:
remove
in interfaceIoFilterChain
-
clear
Description copied from interface:IoFilterChain
Removes all filters added to this chain.- Specified by:
clear
in interfaceIoFilterChain
- Throws:
Exception
- ifIoFilter.onPostRemove(IoFilterChain, String, NextFilter)
thrown an exception.
-
fireSessionCreated
Description copied from interface:IoFilterChain
Fires aIoHandler.sessionCreated(IoSession)
event. Most users don't need to call this method at all. Please use this method only when you implement a new transport or fire a virtual event.- Specified by:
fireSessionCreated
in interfaceIoFilterChain
-
fireSessionOpened
Description copied from interface:IoFilterChain
Fires aIoHandler.sessionOpened(IoSession)
event. Most users don't need to call this method at all. Please use this method only when you implement a new transport or fire a virtual event.- Specified by:
fireSessionOpened
in interfaceIoFilterChain
-
fireSessionClosed
Description copied from interface:IoFilterChain
Fires aIoHandler.sessionClosed(IoSession)
event. Most users don't need to call this method at all. Please use this method only when you implement a new transport or fire a virtual event.- Specified by:
fireSessionClosed
in interfaceIoFilterChain
-
fireSessionIdle
Description copied from interface:IoFilterChain
Fires aIoHandler.sessionIdle(IoSession, IdleStatus)
event. Most users don't need to call this method at all. Please use this method only when you implement a new transport or fire a virtual event.- Specified by:
fireSessionIdle
in interfaceIoFilterChain
-
fireMessageReceived
Description copied from interface:IoFilterChain
Fires aIoFilterChain.fireMessageReceived(IoSession, Object)
event. Most users don't need to call this method at all. Please use this method only when you implement a new transport or fire a virtual event.- Specified by:
fireMessageReceived
in interfaceIoFilterChain
-
fireMessageSent
Description copied from interface:IoFilterChain
Fires aIoHandler.sessionOpened(IoSession)
event. Most users don't need to call this method at all. Please use this method only when you implement a new transport or fire a virtual event.- Specified by:
fireMessageSent
in interfaceIoFilterChain
-
fireExceptionCaught
Description copied from interface:IoFilterChain
Fires aIoHandler.exceptionCaught(IoSession, Throwable)
event. Most users don't need to call this method at all. Please use this method only when you implement a new transport or fire a virtual event.- Specified by:
fireExceptionCaught
in interfaceIoFilterChain
-
fireFilterWrite
Description copied from interface:IoFilterChain
Fires aIoSession.write(Object)
event. Most users don't need to call this method at all. Please use this method only when you implement a new transport or fire a virtual event.- Specified by:
fireFilterWrite
in interfaceIoFilterChain
-
fireFilterClose
Description copied from interface:IoFilterChain
Fires aIoSession.close()
event. Most users don't need to call this method at all. Please use this method only when you implement a new transport or fire a virtual event.- Specified by:
fireFilterClose
in interfaceIoFilterChain
-
getAll
Description copied from interface:IoFilterChain
Returns the list of allIoFilterChain.Entry
s this chain contains.- Specified by:
getAll
in interfaceIoFilterChain
-
getAllReversed
Description copied from interface:IoFilterChain
Returns the reversed list of allIoFilterChain.Entry
s this chain contains.- Specified by:
getAllReversed
in interfaceIoFilterChain
-
contains
Description copied from interface:IoFilterChain
Returns true if this chain contains anIoFilter
with the specified name.- Specified by:
contains
in interfaceIoFilterChain
-
contains
Description copied from interface:IoFilterChain
Returns true if this chain contains the specified filter.- Specified by:
contains
in interfaceIoFilterChain
-
contains
Description copied from interface:IoFilterChain
Returns true if this chain contains anIoFilter
of the specified filterType.- Specified by:
contains
in interfaceIoFilterChain
-
toString
-
finalize
-
doWrite
protected abstract void doWrite(IoSession session, IoFilter.WriteRequest writeRequest) throws Exception - Throws:
Exception
-
doClose
- Throws:
Exception
-