This is the mail archive of the kawa@sourceware.org mailing list for the Kawa project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Multiple Environments in embedded Kawa


On 10/15/2014 02:46 AM, holubar@arsystel.com wrote:
Hello,

I hope this is the right forum for this question.
I'm evaluating the use of Kawa as an embedded scripting engine in a Java
application. I would need to use multiple independent environments (one
per user, for example).
Is this (easily) possible? I could not find any documentation for that and
looking at the source it is not evident how to do that.

This page may be helpful:
http://www.gnu.org/software/kawa/Evaluating-Scheme-expressions-from-Java.html

Note that I strongly recommend having a separate thread for each "user".
There are a number of places Kawa uses thread-local variables to find
the "current whatever" - for example Environment.getCurrent().

This is an area of Kawa I haven't pushed on very hard, so there may be pitfalls.
For example, currently there is a global ModuleManager instance.  You might need
to have it be per-user - depending on what your goals are.

You have to be careful about the security implications.  If users can (directly
or indirectly) type in Scheme expressions, and multiple users can use the same
JVM at the same time, then you have to be extremely careful.  Even if you trust
your users to not be malicious, they might be tricked into doing something bad,
and you don't want that to compromise your entire system.
--
	--Per Bothner
per@bothner.com   http://per.bothner.com/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]