Hello Maciek, On Nov 20, 2007 5:01 PM, Maciek Stachowiak <[EMAIL PROTECTED]> wrote:
> > Hey Trustin, > > Oh wow... so your saying each individual IoSession can "concurrently" use > required code from the initial IoHandler instance? That's pretty amazing > if > that's the case... It is not so uncommon to have a single instance handle multiple requests/sessions at the same time. By default, a servlet container will also instantiate one instance of your servlet(s) and use it concurrently for multiple requests. > would I have to synchronize every method in my IoHandler > (I'm guessing not, but I just want to ask to make sure)... But I would > imagine that I need to synchronize any common data structure (i.e. hashmap > that contains all my IoSession objects), correct? Yes, all access to shared data structures should be properly synchronized. Please note that you can use IoService.getManagedSessions to get all IoSessions http://mina.apache.org/report/1.1/apidocs/org/apache/mina/common/IoService.html#getManagedSessions(java.net.SocketAddress) > Also would you recommend > creating and implementing these data structures in the same class which > extends IoHandlerAdaptor? That's up to you really. If you have a fair amount of business logic, I would put that logic in separate classes, independent of Mina. Maarten > > -- > View this message in context: > http://www.nabble.com/Question-regarding-threading-tf4827942s16868.html#a13859789 > Sent from the Apache MINA Support Forum mailing list archive at Nabble.com > . > >
