[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: JCSP Advice anyone?
below my suggestions on how to solve Your problem using JCSP.
On Thursday 15 December 2005 17:39, Ruth Ivimey-Cook wrote:
> I'm new to using JCSP, and thought this might be a good place to ask for
> help. If I was wrong in that thought, please forgive me...
Well there is a list called Java Threads, which I think centres around JCSP,
but with JCSP being close to Occam I think it is alright.
> What I want to know is am I on the "right track", or is there a better way?
Well looking at the code You sent it looks like a perfect application of
Call-Channels (Look in the JavaDoc for the class jcsp.lang.One2OneCallChannel
there is very good explanation given, iirc). Internally they work with two
channel transactions but, for synchronisation, and data is passed directly.
The server process provides designated methods. When a call arrives the
server process acknowledges this and is put to sleep while these methods are
called in the context of the client process. The server process resumes after
the method call is completed.
The downside is that to use a call-channel one has to extend the call channel
class first to provide the methods You need. Apart from this necessary extra
work they are great. It is even possible to deliver exceptions from the
server to the client. Furthermore, the process placing the call does this by
simply placing a function call, not knowing about the ongoing channel
transactions at all.
Hope this helps, happy hacking ;-)
"Any sufficiently advanced bug is indistinguishable from a feature."