1.4.0RC1 embed questions

Hi all,

Wanted to dive into the new embed API but honestly got a bit lost with
all
the recent changes … I’m hoping someone can have pity.

I’m trying to update JRuby support in GoGoEgo, a CMS based on OSGi and
Restlet. (Google Code Archive - Long-term storage for Google Code Project Hosting.).

We are using JRuby 1.3.1, and nominally JSR223. However, our use case
involves multiple sites and apps sharing a VM, so we maintain some
customized JSR223 engines that understand more localized context than
JVM-wide System.getProperties(). Our customized fork of the
scripting.dev.java.net 1.1.6 JRuby connector uses JavaEmbedUtils and
RubyInstanceConfig to set up paths and the JRuby home so that, for
instance,
each of several sites sharing the VM can each run several Rails
applications.

In checking out 1.4.0RC1 distro, I didn’t find any JSR223
ScriptEngineFactory or ScriptEngine implementations. JavaEmbedUtils and
RubyInstanceConfig seem to still be there, so my customized JSR223
Engine
still works, but based on the announcements of “Java 6 scripting out of
the
box” and the pointers to Red Bridge, I get the feeling I’m now looking
in
the wrong place and missing all the fun …

Can anybody steer me back to the plot?

TIA,

  • Rob

Hi Rob,

JSR223 implementation is included in JRuby 1.4.0RC1. This
implementation is completely different code from the one distributed
at scripting.dev.java.net, so the package name is now
org.jruby.embed.jsr223. However, sources are not included in JRuby’s
source archive, but available to download from
http://kenai.com/projects/jruby-embed/sources.

On Sat, Oct 3, 2009 at 2:12 PM, Rob H.
[email protected] wrote:

We are using JRuby 1.3.1, and nominally JSR223. However, our use case
involves multiple sites and apps sharing a VM, so we maintain some
customized JSR223 engines that understand more localized context than
JVM-wide System.getProperties(). Our customized fork of the
scripting.dev.java.net 1.1.6 JRuby connector uses JavaEmbedUtils and
RubyInstanceConfig to set up paths and the JRuby home so that, for instance,
each of several sites sharing the VM can each run several Rails
applications.

I recommend using Embed Core to avoid VM wide setting. Please walk
through Wiki, http://kenai.com/projects/jruby-embed/pages/Home. Embed
Core is designed to run multiple web applications on a single VM. You
can directly set parameters using RubyInstanceCondfig. Of course, you
can set paths and jruby home by methods if you use Embed Core. I
haven’t tested Rails on Embed Core and guess it would not be good
combination right now.

In checking out 1.4.0RC1 distro, I didn’t find any JSR223
ScriptEngineFactory or ScriptEngine implementations. JavaEmbedUtils and
RubyInstanceConfig seem to still be there, so my customized JSR223 Engine
still works, but based on the announcements of “Java 6 scripting out of the
box” and the pointers to Red Bridge, I get the feeling I’m now looking in
the wrong place and missing all the fun …

In future, JRuby Embed will probably obsolete JavaEmbedUtils and other
embed related old API, but not now. Since many existing packages use
JavaEmbedUtils, it needs time to eliminate JavaEmbedUtils and others.

-Yoko


To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

Thanks for the detailed reply! I got the scripting source from Kenai.
Looks MUCH better! I’m especially excited to see that the engine
eval(…)
method no longer has to be synchronized as in the
scripting.dev.java.netversion. That will be a big performance boost
for several cases I know.
I’ll move to start testing it right away!

Embed Core seems to offer enough advantages over JSR 223 for Ruby
integration that I will figure out some path to allow users to access it
directly, instead of the generic support that works for all script
engines.

  • Rob