Re: [Beepcore-java-users] Concurrency
Status: Beta
Brought to you by:
huston
From: Huston <hu...@us...> - 2002-09-09 19:50:44
|
> 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 |