The issue that you'll run into is that there is one lexical scope that is shared by all calls to Clojure. The only ways around this are (1) run it in another process, and (2) load the Clojure JARs into a ClassLoader at runtime, and throw the ClassLoader away after every call.
The overhead for option 2 is between 0.5 and 1 second per call, because Clojure has to be re-inited. For option 1, it's even more because you are starting Java, then initing Java. Threads have nothing to do with the Clojure lexical scoping. If you run 100 threads, they normally all share the same variables, namespaces, and functions. For more info, you can check out http://sandflea.googlecode.com/svn/site/maven-clojure-plugin/1.1.0/clojure-commons/apidocs/index.html?sandflea/clojure/scripting/ClojureScripting.html (http://code.google.com/p/sandflea/source/browse/maven-clojure-plugin/ trunk/clojure-commons/src/main/java/sandflea/clojure/scripting/ ClojureScripting.java). On May 27, 3:46 pm, BerlinBrown <berlin.br...@gmail.com> wrote: > I enjoy clojure and I think I am breaking all the rules. I have an > app that I originally created in clojure. It has been a year off and > on. And I merged that code with some existing java database code. > > The clojure code invokes the java code. Now, I want to have a script > environment where users can invoke their own clojure code. But I was > think the clojure code should run in a completely new, separate > environment, via a thread. > > Basically. > > 1. Clojure is invokved (clojure.main) > 2. I have clojure code that invokes code originally written in Java > 3. That java code creates another separate clojure instance, parsing a > clojure script. (an embedded dsl) > > It isn't that confusing. It is almost akin to invoking a JSP page > from a running web server. -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en