(snip)
Secondly, if the http-session is used, the jruby java object representing
session state are of the type org.jruby.RubyObject which does
implement the java.io.Serializable interface and hence are not serializable.
I'm assuming that at least some of the JavaEE application servers use
this interface to provide distributable/presitent sessions (and I know
one that does for sure ;) ). The important question here is that can, the
objects that get stored as session information be (somehow) made serializable ?
I'm also interested in figuring out how MRI ruby or ror implements the
java-equivalent-of-serialization. Any pointers on that appreciated.

Ruby's equivalent of serialization is called "marshalling", using the Marshal class. We have marshalling implemented in JRuby, and at the moment I believe all known bugs have been fixed. It's the format used for both file-based stores and database stores for the session.

I understand the issue you/we would have trying to store the Rails session in the Java servlet session...we want it to be able to cluster, which is typically done by serializing the session across servers. At the moment, I have only two thoughts:

1. Implement Java serialization in JRuby objects to use Ruby's marshalling format on the way in and the way out. This is problematic since on the receiving end the session is unlikely to have access to a runtime in which to restore itself. Until we can completely detach a live object from a given runtime, this is out of reach. 2. Implement an alternative app server session store that saves marshalled content (as a String or byte[]) in the session rather than as individual attributes. This would serialize fine, and the Rails app on the other end would know how to reconstitute it. However, it would be a performance hit (as would the DB-based session) since it would have to marshal and unmarshal the session every time.
Aren't #1 and #2 essentially the same under the covers - in #1 its java's serialization at the surface and jruby's marshalling implementation that really doing the work and in #2 it's a more direct call
to the jruby marshalling system ?

-Ashish


3. Modify the current session store to only put serializable content into the session, converting Ruby objects to Java objects if necessary.

- Charlie
_______________________________________________
Jruby-extras-devel mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/jruby-extras-devel


--
Ashish
http://blogs.sun.com/whacko

_______________________________________________
Jruby-extras-devel mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/jruby-extras-devel

Reply via email to