Re: [eclipse-clp-users] looking for AsyncEclipseQueue sample code

From: Kish Shen <kisshen_at_...5...>
Date: Mon, 03 Jan 2011 08:38:53 +0000
On 28/12/2010 08:48, -dp- wrote:
> I'm planning to refactor an EmbeddedEclipse design that uses listeners on
> to/from queues to a design using OutOfProcessEclipse
> using AsyncEclipseQueue.
>
> I'm doing this because I need my UI to allow the user to "pause" CLP by
> sending sleep commands in response to dataRequest's until the user presses a
> Next button. Because the to/from queues block, the Next button never gets
> any cycles to do its work. (And paint's don't occur until EmbeddedEclipse is
> destroyed.)
>
> I've read the embedding manual on AsyncEclipseQueue, and it advises using
> different threads to run rpc and to read/write to the queue(s). However,
> it's unclear to me whether it makes sense to put my UI on the same thread as
> the rpc; I'd like to minimize threads.
>
> Also, it's unclear how the CLP side can check whether there is an active
> thread available to read data it's ready to write, as section 8.6.1 advises.
>
> The Google didn't turn up any sample code; can someone point me to some,
> perhaps involving a JFrame?
>

I am not really that familiar with the Java interface, but I am familiar 
with the general concepts that the Java interface uses (the same generic 
interface is used to interface different languages to ECLiPSe, and since 
you have not yet got a reply, I will give it a try.

I am not sure I understand why you want to `refactor'  your design with 
moving form Embedded to OutOfProcess -- one important goal when we 
designed the interface was that you can reuse the same design (and most 
of the code) for the different flavours of interfaces.

I am also not quite sure I understand the interaction you have (or want 
to have), with the to/from queues, execution of ECLiPSe is 'paused' when 
the Java side has control, regardless of what flavour of interface you 
are using. This was a very deliberate design decision, to keep the 
interaction between ECLiPSe and Java simple.

My suggestion, from what I can understand, is that if your user is not 
ready to send data to ECLiPSe when a dataRequest happens, is that you 
should send something that represents 'Not ready' to the ToECliPSe queue 
that is requesting the data, and on your ECLiPSe side, when you read 
this 'Not ready' item, will then pause and hand control back to
Java, effectively pausing your ECLiPSe execution as you want.

As for asynchronous queues in general, my suggestion is that you should 
avoid them if at all possible, and even if you do use them, they should 
be used to do very simple things, e.g. if you simply want to display 
outputs generated by ECLiPSe. There are some unresolved issues (probably 
bugs) with using asynchronous queues with the remote (OutOfProcess) 
interface.

Hope this helps. Please feel free to post again if you have more 
questions, or if I have completely misunderstood what you are trying to 
do....

Cheers,

Kish

-- 
This e-mail may contain confidential and privileged material for the
sole use of the intended recipient. Any review, use, distribution or
disclosure by others is strictly prohibited. If you are not the intended
recipient (or authorized to receive for the recipient), please contact
the sender by reply e-mail and delete all copies of this message.
Cisco Systems Limited (Company Number: 02558939), is registered in
England and Wales with its registered office at 1 Callaghan Square,
Cardiff, South Glamorgan CF10 5BT.
Received on Mon Jan 03 2011 - 08:39:20 CET

This archive was generated by hypermail 2.3.0 : Wed Sep 25 2024 - 15:13:20 CEST