Fausto Lelli wrote:
> ah ok,
> so the marshalled ruby object carries with it all the runtime info
> or else ?
> in the latter case how big would it be ?

Looks like there's still a little confusion here. Let me set out the 
facts clearly.

Java serialization:

1. Happens when the app server wants it to (i.e. app server "pulls" the 
objects and "pushes" them back onto another JVM). In other words, it 
happens at a level we can't control.
2. Can't serialize all of a RubyObject yet (including but not limited to 
RubyModule and its methods, Ruby runtime, and so on) because many of 
those objects are linked to the rest of the Ruby object/class graph.
3. Can't deserialize an object such that we can use it on the other 
side, because of (2) the Ruby runtime field doesn't survive 
serialization and because of (1) the objects arriving at the target 
server can't be reattached to a new runtime.

We can't control both ends of the serialization in an app server, which 
means we can't specify that objects coming out of the pipe should be 
instantiated for a given runtime. So the bottom line here is that until 
a Ruby object can be passed freely from Ruby runtime to Ruby runtime, we 
can't reliably serialize them using Java serialization.

Ruby marshalling:

1. Is initiated by the application code, not by the host runtime or 
server (i.e. Rails asks Ruby to push the objects out to a store and pull 
them back in on the other side)
2. Is dependent on a Ruby runtime being present to unmarshal all 
objects, but this is ok because of (1) we know a runtime will be present.
3. Can marshal objects from one runtime to another because only the 
relevant data for the objects is persisted to the other side.

A combined approach would be possible if and only if the marshalling 
logic can be modified to work without a Ruby runtime present, since the 
limitations of Java serialization prevent us from providing a rich 
object deserializer when we aren't initiating the serialization or 
deserialization process.

Think of it like this: You want to serialize a graph of Java objects and 
send them to a C-based server...without a Java runtime on the other end, 
you wouldn't be able to do anything with those objects.

Hopefully this clears things up a bit...

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

Reply via email to