You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jdo-dev@db.apache.org by Craig L Russell <Cr...@Sun.COM> on 2007/11/28 21:00:31 UTC
Serializing PersistenceManager
Comments please...
<proposed>
12.18 Serialization
Serializing or externalizing a persistence manager is an optional
feature of a jdo implementation. If an implementation of
PersistenceManager (including PersistenceManager proxy) is declared
as implementing Serializable or Externalizable, then the
corresponding PersistenceManagerFactory must also be declared as
implementing Serializable or Externalizable and vice versa. In this
section, serialization refers to both serialization and externalization.
Serializing a persistence manager works in conjunction with
serializing other state, independent of the persistence manager. A
persistence manager whose writeObject or writeExternal method is
called must therefore not assume that it is the root object of
serialization.
When serialized, a persistence manager must write out its own state
as well as the state of each of its managed instances. It must write
a reference to its corresponding persistence manager factory
sufficient to locate or create it when restored. It must write the
life cycle state of all instances that have not been garbage
collected. It must write the before image of dirty instances in order
to restore these instances later.
Serialization must only be done when there is no datastore
transaction enlisted. That is, a datastore transaction must not be
active; and if an optimistic transaction is active, flush must not
have been called. If either of these conditions exists,
JDOUserException is thrown.
</proposed>
I'll add more details on restoring the state of a persistence manager...
Craig Russell
Architect, Sun Java Enterprise System http://java.sun.com/products/jdo
408 276-5638 mailto:Craig.Russell@sun.com
P.S. A good JDO? O, Gasp!
Re: Serializing PersistenceManager
Posted by Craig L Russell <Cr...@Sun.COM>.
Hi Erik,
On Nov 29, 2007, at 12:35 PM, Erik Bengtson wrote:
> Craig,
>
> what's the meaning of this? Something to do with non tx writes?
>
> "...It must write the before image of dirty instances in order
> to restore these instances later...."
Here's what I had in mind. Subject to discussion and approval by the
expert group.
The serialization might be done in an optimistic transaction (before
flush) or outside a transaction. There might be dirty instances
(persistent-dirty or persistent-nontransactional-dirty) whose changes
need to be preserved in the serialized PersistenceManager so the
updates can be written to the datastore in the restored context. If
the optimistic transaction is subsequently rolled back, the
restoreValues flag should control the treatment of the dirty instance
(which means restoring field values from the before image).
Craig
>
>
>
>
Craig Russell
Architect, Sun Java Enterprise System http://java.sun.com/products/jdo
408 276-5638 mailto:Craig.Russell@sun.com
P.S. A good JDO? O, Gasp!
RE: Serializing PersistenceManager
Posted by Erik Bengtson <er...@jpox.org>.
Craig,
what's the meaning of this? Something to do with non tx writes?
"...It must write the before image of dirty instances in order
to restore these instances later...."