Maarten, I understand that the messageReceived will never be called simultaneously for the same session. But it can be called concurrently for different IoSession's.
Let put a real example. A Server Application that received SQL Query from different client connected to it. Each client sent a SQL query to the Server. The Server has 10 connections to the database. How the messageReceived can process each client request (SQL Query) simultaneously, using the 10 connections ? Angel Figueroa Maarten Bosteels wrote: > > Angel, > > Your question is not really clear to me. > What exactly are you worried about ? > Note that, by default, messageReceived will never be called simultaneously > for the same session. > But it can be called concurrently for different IoSession's, this does not > pose a problem by itself. > You just have to make sure your implementation is thread-safe: don't store > conversattional state in instance fields of your IoHandler and properly > synchronize access to shared data. > This is all very analogous to servlet programming. > > Maarten > > On 11/1/07, Angel.Figueroa <[EMAIL PROTECTED]> wrote: >> >> >> If more that one message is received at the same time. How to control the >> execution of the business logic method. >> >> public void messageReceived(IoSession session, Object message) throws >> Exception >> { >> >> >> //---------------------------------------------------------------------- >> // received the Request Transaction >> >> //---------------------------------------------------------------------- >> String theMessage = ( String ) message; >> >> //-------------------------------------------------------------- >> // Process Transaction Code business logic method >> //-------------------------------------------------------------- >> theMessage = transaction.ProcessTransaction(theMessage,arclient); >> >> >> //---------------------------------------------------------------------- >> // send the response Transaction Back >> >> //---------------------------------------------------------------------- >> session.write(theMessage); >> } >> >> -- >> View this message in context: >> http://www.nabble.com/messageReceived-and-bussiness-logic-tf4729241s16868.html#a13522950 >> Sent from the Apache MINA Support Forum mailing list archive at >> Nabble.com >> . >> >> > > -- View this message in context: http://www.nabble.com/messageReceived-and-bussiness-logic-tf4729241s16868.html#a13541041 Sent from the Apache MINA Support Forum mailing list archive at Nabble.com.