public class ReferenceCountingFilter extends IoFilterAdapter
IoFilter
s wrapper that keeps track of the number of usages of this filter and will call init/destroy
when the filter is not in use.IoFilter.NextFilter
Constructor and Description |
---|
ReferenceCountingFilter(IoFilter filter) |
Modifier and Type | Method and Description |
---|---|
void |
destroy()
Invoked by
ReferenceCountingFilter when this filter
is not used by any IoFilterChain anymore, so you can destroy
shared resources. |
void |
exceptionCaught(IoFilter.NextFilter nextFilter,
IoSession session,
java.lang.Throwable cause)
Filters
IoHandler.exceptionCaught(IoSession,Throwable)
event. |
void |
filterClose(IoFilter.NextFilter nextFilter,
IoSession session)
Filters
IoSession.close() method invocation. |
void |
filterWrite(IoFilter.NextFilter nextFilter,
IoSession session,
WriteRequest writeRequest)
Filters
IoSession.write(Object) method invocation. |
void |
init()
Invoked by
ReferenceCountingFilter when this filter
is added to a IoFilterChain at the first time, so you can
initialize shared resources. |
void |
messageReceived(IoFilter.NextFilter nextFilter,
IoSession session,
java.lang.Object message)
Filters
IoHandler.messageReceived(IoSession,Object)
event. |
void |
messageSent(IoFilter.NextFilter nextFilter,
IoSession session,
WriteRequest writeRequest)
Filters
IoHandler.messageSent(IoSession,Object)
event. |
void |
onPostAdd(IoFilterChain parent,
java.lang.String name,
IoFilter.NextFilter nextFilter)
Invoked after this filter is added to the specified parent.
|
void |
onPostRemove(IoFilterChain parent,
java.lang.String name,
IoFilter.NextFilter nextFilter)
Invoked after this filter is removed from the specified parent.
|
void |
onPreAdd(IoFilterChain parent,
java.lang.String name,
IoFilter.NextFilter nextFilter)
Invoked before this filter is added to the specified parent.
|
void |
onPreRemove(IoFilterChain parent,
java.lang.String name,
IoFilter.NextFilter nextFilter)
Invoked before this filter is removed from the specified parent.
|
void |
sessionClosed(IoFilter.NextFilter nextFilter,
IoSession session)
Filters
IoHandler.sessionClosed(IoSession) event. |
void |
sessionCreated(IoFilter.NextFilter nextFilter,
IoSession session)
Filters
IoHandler.sessionCreated(IoSession) event. |
void |
sessionIdle(IoFilter.NextFilter nextFilter,
IoSession session,
IdleStatus status)
Filters
IoHandler.sessionIdle(IoSession,IdleStatus)
event. |
void |
sessionOpened(IoFilter.NextFilter nextFilter,
IoSession session)
Filters
IoHandler.sessionOpened(IoSession) event. |
toString
public ReferenceCountingFilter(IoFilter filter)
public void init() throws java.lang.Exception
IoFilterAdapter
ReferenceCountingFilter
when this filter
is added to a IoFilterChain
at the first time, so you can
initialize shared resources. Please note that this method is never
called if you don't wrap a filter with ReferenceCountingFilter
.init
in interface IoFilter
init
in class IoFilterAdapter
java.lang.Exception
public void destroy() throws java.lang.Exception
IoFilterAdapter
ReferenceCountingFilter
when this filter
is not used by any IoFilterChain
anymore, so you can destroy
shared resources. Please note that this method is never called if
you don't wrap a filter with ReferenceCountingFilter
.destroy
in interface IoFilter
destroy
in class IoFilterAdapter
java.lang.Exception
public void onPreAdd(IoFilterChain parent, java.lang.String name, IoFilter.NextFilter nextFilter) throws java.lang.Exception
IoFilterAdapter
IoFilter.init()
is invoked.onPreAdd
in interface IoFilter
onPreAdd
in class IoFilterAdapter
parent
- the parent who called this methodname
- the name assigned to this filternextFilter
- the IoFilter.NextFilter
for this filter. You can reuse
this object until this filter is removed from the chain.java.lang.Exception
public void onPostRemove(IoFilterChain parent, java.lang.String name, IoFilter.NextFilter nextFilter) throws java.lang.Exception
IoFilterAdapter
IoFilter.destroy()
is invoked.onPostRemove
in interface IoFilter
onPostRemove
in class IoFilterAdapter
parent
- the parent who called this methodname
- the name assigned to this filternextFilter
- the IoFilter.NextFilter
for this filter. You can reuse
this object until this filter is removed from the chain.java.lang.Exception
public void exceptionCaught(IoFilter.NextFilter nextFilter, IoSession session, java.lang.Throwable cause) throws java.lang.Exception
IoFilterAdapter
IoHandler.exceptionCaught(IoSession,Throwable)
event.exceptionCaught
in interface IoFilter
exceptionCaught
in class IoFilterAdapter
java.lang.Exception
public void filterClose(IoFilter.NextFilter nextFilter, IoSession session) throws java.lang.Exception
IoFilterAdapter
IoSession.close()
method invocation.filterClose
in interface IoFilter
filterClose
in class IoFilterAdapter
java.lang.Exception
public void filterWrite(IoFilter.NextFilter nextFilter, IoSession session, WriteRequest writeRequest) throws java.lang.Exception
IoFilterAdapter
IoSession.write(Object)
method invocation.filterWrite
in interface IoFilter
filterWrite
in class IoFilterAdapter
java.lang.Exception
public void messageReceived(IoFilter.NextFilter nextFilter, IoSession session, java.lang.Object message) throws java.lang.Exception
IoFilterAdapter
IoHandler.messageReceived(IoSession,Object)
event.messageReceived
in interface IoFilter
messageReceived
in class IoFilterAdapter
java.lang.Exception
public void messageSent(IoFilter.NextFilter nextFilter, IoSession session, WriteRequest writeRequest) throws java.lang.Exception
IoFilterAdapter
IoHandler.messageSent(IoSession,Object)
event.messageSent
in interface IoFilter
messageSent
in class IoFilterAdapter
java.lang.Exception
public void onPostAdd(IoFilterChain parent, java.lang.String name, IoFilter.NextFilter nextFilter) throws java.lang.Exception
IoFilterAdapter
IoFilter.init()
is invoked.onPostAdd
in interface IoFilter
onPostAdd
in class IoFilterAdapter
parent
- the parent who called this methodname
- the name assigned to this filternextFilter
- the IoFilter.NextFilter
for this filter. You can reuse
this object until this filter is removed from the chain.java.lang.Exception
public void onPreRemove(IoFilterChain parent, java.lang.String name, IoFilter.NextFilter nextFilter) throws java.lang.Exception
IoFilterAdapter
IoFilter.destroy()
is invoked.onPreRemove
in interface IoFilter
onPreRemove
in class IoFilterAdapter
parent
- the parent who called this methodname
- the name assigned to this filternextFilter
- the IoFilter.NextFilter
for this filter. You can reuse
this object until this filter is removed from the chain.java.lang.Exception
public void sessionClosed(IoFilter.NextFilter nextFilter, IoSession session) throws java.lang.Exception
IoFilterAdapter
IoHandler.sessionClosed(IoSession)
event.sessionClosed
in interface IoFilter
sessionClosed
in class IoFilterAdapter
java.lang.Exception
public void sessionCreated(IoFilter.NextFilter nextFilter, IoSession session) throws java.lang.Exception
IoFilterAdapter
IoHandler.sessionCreated(IoSession)
event.sessionCreated
in interface IoFilter
sessionCreated
in class IoFilterAdapter
java.lang.Exception
public void sessionIdle(IoFilter.NextFilter nextFilter, IoSession session, IdleStatus status) throws java.lang.Exception
IoFilterAdapter
IoHandler.sessionIdle(IoSession,IdleStatus)
event.sessionIdle
in interface IoFilter
sessionIdle
in class IoFilterAdapter
java.lang.Exception
public void sessionOpened(IoFilter.NextFilter nextFilter, IoSession session) throws java.lang.Exception
IoFilterAdapter
IoHandler.sessionOpened(IoSession)
event.sessionOpened
in interface IoFilter
sessionOpened
in class IoFilterAdapter
java.lang.Exception
Copyright © 2004-2019 Apache MINA Project. All Rights Reserved.