public class RequestResponseFilter extends WriteRequestFilter
IoFilter.NextFilter| Constructor and Description |
|---|
RequestResponseFilter(ResponseInspectorFactory responseInspectorFactory,
ScheduledExecutorService timeoutScheduler) |
RequestResponseFilter(ResponseInspector responseInspector,
ScheduledExecutorService timeoutScheduler) |
| Modifier and Type | Method and Description |
|---|---|
protected Map<Object,Request> |
createRequestStore(IoSession session)
|
protected Set<Request> |
createUnrespondedRequestStore(IoSession session)
|
protected void |
destroyRequestStore(Map<Object,Request> requestStore)
Releases any resources related with the
Map created by
createRequestStore(IoSession). |
protected void |
destroyUnrespondedRequestStore(Set<Request> unrespondedRequestStore)
Releases any resources related with the
Set created by
createUnrespondedRequestStore(IoSession). |
protected Object |
doFilterWrite(IoFilter.NextFilter nextFilter,
IoSession session,
WriteRequest writeRequest) |
void |
messageReceived(IoFilter.NextFilter nextFilter,
IoSession session,
Object message)
Filters
IoHandler.messageReceived(IoSession,Object)
event. |
void |
onPostRemove(IoFilterChain parent,
String name,
IoFilter.NextFilter nextFilter)
Invoked after this filter is removed from the specified parent.
|
void |
onPreAdd(IoFilterChain parent,
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, messageSentdestroy, exceptionCaught, filterClose, init, onPostAdd, onPreRemove, sessionCreated, sessionIdle, sessionOpened, toStringpublic RequestResponseFilter(ResponseInspector responseInspector, ScheduledExecutorService timeoutScheduler)
public RequestResponseFilter(ResponseInspectorFactory responseInspectorFactory, ScheduledExecutorService timeoutScheduler)
public void onPreAdd(IoFilterChain parent, String name, IoFilter.NextFilter nextFilter) throws Exception
IoFilterAdapterIoFilter.init() is invoked.onPreAdd in interface IoFilteronPreAdd in class IoFilterAdapterparent - 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.Exceptionpublic void onPostRemove(IoFilterChain parent, String name, IoFilter.NextFilter nextFilter) throws Exception
IoFilterAdapterIoFilter.destroy() is invoked.onPostRemove in interface IoFilteronPostRemove in class IoFilterAdapterparent - 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.Exceptionpublic void messageReceived(IoFilter.NextFilter nextFilter, IoSession session, Object message) throws Exception
IoFilterAdapterIoHandler.messageReceived(IoSession,Object)
event.messageReceived in interface IoFiltermessageReceived in class IoFilterAdapterExceptionprotected Object doFilterWrite(IoFilter.NextFilter nextFilter, IoSession session, WriteRequest writeRequest) throws Exception
doFilterWrite in class WriteRequestFilterExceptionpublic void sessionClosed(IoFilter.NextFilter nextFilter, IoSession session) throws Exception
IoFilterAdapterIoHandler.sessionClosed(IoSession) event.sessionClosed in interface IoFiltersessionClosed in class IoFilterAdapterExceptionprotected Set<Request> createUnrespondedRequestStore(IoSession session)
Set which stores Request whose
Responses 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
RequestTimeoutExceptions are thrown in the order which
Requests were written. If you don't need to guarantee
the order of thrown exceptions, any Set implementation
can be used.protected void destroyRequestStore(Map<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(Set<Request> unrespondedRequestStore)
Set created by
createUnrespondedRequestStore(IoSession). This method is
useful if you override createUnrespondedRequestStore(IoSession).unrespondedRequestStore - what you returned in createUnrespondedRequestStore(IoSession)