Interface IoHandlerCommand
-
- All Known Implementing Classes:
IoHandlerChain
public interface IoHandlerCommandA
IoHandlerCommandencapsulates a unit of processing work to be performed, whose purpose is to examine and/or modify the state of a transaction that is represented by custom attributes provided byIoSession. IndividualIoHandlerCommands can be assembled into aIoHandlerChain, which allows them to either complete the required processing or delegate further processing to the nextIoHandlerCommandin theIoHandlerChain.IoHandlerCommandimplementations typically retrieve and store state information in theIoSessionthat is passed as a parameter to theexecute(NextCommand,IoSession,Object)method, using custom session attributes. If you think getting attributes is tedious process, you can create a bean which contains getters and setters of all properties and store the bean as a session attribute:public class MyContext { public String getPropertyX() { ... }; public void setPropertyX(String propertyX) { ... }; public int getPropertyZ() { ... }; public void setPropertyZ(int propertyZ) { ... }; } public class MyHandlderCommand implements IoHandlerCommand { public void execute( NextCommand next, IoSession session, Object message ) throws Exception { MyContext ctx = session.getAttribute( "mycontext" ); ... } }- Author:
- Apache MINA Project
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interfaceIoHandlerCommand.NextCommandRepresents an indirect reference to the nextIoHandlerCommandof theIoHandlerChain.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidexecute(IoHandlerCommand.NextCommand next, IoSession session, Object message)Execute a unit of processing work to be performed.
-
-
-
Method Detail
-
execute
void execute(IoHandlerCommand.NextCommand next, IoSession session, Object message) throws Exception
Execute a unit of processing work to be performed. This
IoHandlerCommandmay either complete the required processing and just return to stop the processing, or delegate remaining processing to the nextIoHandlerCommandin aIoHandlerChaincontaining thisIoHandlerCommandby callingIoHandlerCommand.NextCommand.execute(IoSession,Object).- Parameters:
next- an indirect reference to the nextIoHandlerCommandthat provides a way to forward the request to the nextIoHandlerCommand.session- theIoSessionwhich is associated with this requestmessage- the message object of this request- Throws:
Exception- general purpose exception return to indicate abnormal termination
-
-