Re: Concurrency

"Huston" <[email protected]> Mon, 9 Sep 2002 13:49:47 -0600
Newsgroups gmane.network.beep.beepcore.java.general
Message-ID <[email protected]>
> 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



-------------------------------------------------------
This sf.net email is sponsored by: OSDN - Tired of that same old
cell phone?  Get a new here for FREE!
https://www.inphonic.com/r.asp?r=sourceforge1&refcode1=vs3390