> I have a 'Profile' (implementing MessageListener) that can be used
> in multiple 'Session's. Since there is a thread per 'Session', I'm
> assuming same 'Profile' object will be used by multiple session
> threads. So the responsibility of thread-safety falls on profile
> author. Right?
Yes, if you share the MessageListener between multiple channels.
> Is there a way to have a separate instance of profile per
> session/thread. If not, could somebody educate me on it's pros/cons?
Profile, StartChannelListener, and MessageListener are separate interfaces
so you can have separate instances per listener, session, and channel
respectfully.
If you want to avoid locking in your MessageListener then you will need to
allocate a MessageListener per channel since messages can be received in
parallel in different channels.
--Huston
|