Here at GemStone we are investigating adding transparent object
'persistence by reachability' to JRuby. We have run JRuby in our JVM
and have the persistence working. But we end up persisting too much
because of the attachment of JRuby objects to the runtime. Whenever
an object is saved, all objects reachable via its instance variables
are also saved. When it can reach the runtime, we end up persisting
way more than we want, and trying to persist some things that are not
persistable (threads, for example). I realize that the coupling to
the runtime is a problem in supporting serialiazation/deserialization
as well.
It looks like the gateway to the runtime is via the metaclass
instance variable in JRubyObject. Couldn't that be made transient?
This would go a long way toward decoupling the runtime from the
application objects for the purposes of serialization and persistence.
Reattaching persisted objects to the runtime would be more difficult.
I am told that there have been ideas about how to do this voiced in
the past, but the issue has been deferred until now. One suggestion
for reattaching a persistent object to the runtime is to have an
accessor that lazily initializes the runtime connection. On the first
invocation after the object is loaded from the database or
deserialized, it would restore the connection to the runtime. Both
the overhead and the impact to the code base would be minimal.
I admit that I have only browsed the source, so it is very possible
that I have missed something important. If so, I would love to be
involved in the discussion.
---------------------------------------------------------------------
To unsubscribe from this list please visit:
http://xircles.codehaus.org/manage_email