I have intermixed Groovy and JCSP easily and reliably, but not at the low-level 
thread level.


I use two libraries JCSP (CSP for Java) which provides a process based 
interface that enables the construction of multiprocess applications, either on 
a multi-core machine or on a cluster of multi-core machines.


In addition I have created a set of Groovy helper classes, groovyJCSP, that 
create a much simpler user enviroment to the underlying JCSP library.  These 
libraries have been used for more than 10 years, mostly in teaching but also to 
undertake large scale application development.


My github account has these libraries available 
(https://github.com/JonKerridge), which has examples of the use of the library 
including much higher level management of access to shared variables, including 
access to partitioned data structures such that two processes can read all the 
data but only one can write to a specific partition.


Jon

Professor Jon Kerridge
School of Computing
Edinburgh Napier University
Merchiston Campus
Edinburgh EH10 5DT

0131 455 2777
j.kerri...@napier.ac.uk<mailto:j.kerri...@napier.ac.uk>

<http://www.soc.napier.ac.uk/~cs10/>

________________________________
From: Blake McBride <blake1...@gmail.com>
Sent: 20 April 2018 12:45:31
To: users@groovy.apache.org
Subject: Re: Re-entrant and multi-entrant Groovy calls

Thanks.  Speaking of Java alone, I understand that many Java API's are not 
thread safe.  That's fine.  However, with respect to Java alone, I can have any 
number of threads and so long as no thread touches the same (application) 
variables at the same time, I'm always safe.

I understand that I must take this into account when using Groovy too.  My 
problem is that I don't know if Groovy has some internal stuff that will break 
even if I have no application variable problems.

Thanks.

Blake McBride


On Fri, Apr 20, 2018 at 6:34 AM, Jochen Theodorou 
<blackd...@gmx.org<mailto:blackd...@gmx.org>> wrote:


Am 20.04.2018 um 11:21 schrieb Blake McBride:
Greetings,

Does Groovy safely support re-entrant and multi-entrant calls?  What I mean by 
that is the following:

Re-entrant:  on a single OS thread - my Java program calls into Groovy, then 
Groovy calls into my Java application, and then the Java application calls back 
into Groovy.  So the stack has Java, Groovy, JAVA, and then Groovy again.

Multi-entrant:  my Java application has many threads.  One of my threads calls 
into Groovy.  Then, while one thread is still in Groovy, another thread evokes 
Groovy.  So now we have two calls into Groovy by two independent Java/OS 
threads running at the same time.

this is actually difficult to answer. The runtime system is designed to be safe 
for multi entrant usages (minus bugs of course). But just like in Java that 
does not mean all parts of the API are safe for this usage, not even groovy.lang

bye Jochen


This message and its attachment(s) are intended for the addressee(s) only and 
should not be read, copied, disclosed, forwarded or relied upon by any person 
other than the intended addressee(s) without the permission of the sender. If 
you are not the intended addressee you must not take any action based on this 
message and its attachment(s) nor must you copy or show them to anyone. Please 
respond to the sender and ensure that this message and its attachment(s) are 
deleted.

It is your responsibility to ensure that this message and its attachment(s) are 
scanned for viruses or other defects. Edinburgh Napier University does not 
accept liability for any loss or damage which may result from this message or 
its attachment(s), or for errors or omissions arising after it was sent. Email 
is not a secure medium. Emails entering Edinburgh Napier University's system 
are subject to routine monitoring and filtering by Edinburgh Napier University.

Edinburgh Napier University is a registered Scottish charity. Registration 
number SC018373

Reply via email to