public class RequestResponseFilter extends WriteRequestFilter
IoFilter.NextFilter
Constructor and Description |
---|
RequestResponseFilter(ResponseInspectorFactory responseInspectorFactory,
java.util.concurrent.ScheduledExecutorService timeoutScheduler) |
RequestResponseFilter(ResponseInspector responseInspector,
java.util.concurrent.ScheduledExecutorService timeoutScheduler) |
Modifier and Type | Method and Description |
---|---|
protected java.util.Map<java.lang.Object,Request> |
createRequestStore(IoSession session)
|
protected java.util.Set<Request> |
createUnrespondedRequestStore(IoSession session)
|
protected void |
destroyRequestStore(java.util.Map<java.lang.Object,Request> requestStore)
Releases any resources related with the
Map created by
createRequestStore(IoSession) . |
protected void |
destroyUnrespondedRequestStore(java.util.Set<Request> unrespondedRequestStore)
Releases any resources related with the
Set created by
createUnrespondedRequestStore(IoSession) . |
protected java.lang.Object |
doFilterWrite(IoFilter.NextFilter nextFilter,
IoSession session,
WriteRequest writeRequest) |
void |
messageReceived(IoFilter.NextFilter nextFilter,
IoSession session,
java.lang.Object message)
Filters
IoHandler.messageReceived(IoSession,Object)
event. |
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 |
sessionClosed(IoFilter.NextFilter nextFilter,
IoSession session)
Filters
IoHandler.sessionClosed(IoSession) event. |
filterWrite, messageSent
destroy, exceptionCaught, filterClose, init, onPostAdd, onPreRemove, sessionCreated, sessionIdle, sessionOpened, toString
public RequestResponseFilter(ResponseInspector responseInspector, java.util.concurrent.ScheduledExecutorService timeoutScheduler)
public RequestResponseFilter(ResponseInspectorFactory responseInspectorFactory, java.util.concurrent.ScheduledExecutorService timeoutScheduler)
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 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
protected java.lang.Object doFilterWrite(IoFilter.NextFilter nextFilter, IoSession session, WriteRequest writeRequest) throws java.lang.Exception
doFilterWrite
in class WriteRequestFilter
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
protected java.util.Map<java.lang.Object,Request> createRequestStore(IoSession session)
protected java.util.Set<Request> createUnrespondedRequestStore(IoSession session)
Set
which stores Request
whose
Response
s are not received yet. Please override
this method if you need to use other Set
implementation
than the default one (LinkedHashSet
). Please note that
the Iterator
of the returned Set
have to iterate
its elements in the insertion order to ensure that
RequestTimeoutException
s are thrown in the order which
Request
s were written. If you don't need to guarantee
the order of thrown exceptions, any Set
implementation
can be used.protected void destroyRequestStore(java.util.Map<java.lang.Object,Request> requestStore)
Map
created by
createRequestStore(IoSession)
. This method is useful
if you override createRequestStore(IoSession)
.requestStore
- what you returned in createRequestStore(IoSession)
protected void destroyUnrespondedRequestStore(java.util.Set<Request> unrespondedRequestStore)
Set
created by
createUnrespondedRequestStore(IoSession)
. This method is
useful if you override createUnrespondedRequestStore(IoSession)
.unrespondedRequestStore
- what you returned in createUnrespondedRequestStore(IoSession)
Copyright © 2004-2019 Apache MINA Project. All Rights Reserved.