Sent from my iPhone

On Sep 22, 2010, at 6:27 AM, Sean Owen <[email protected]> wrote:

Embedded in my question is, what is GSON used for at this stage? There
are potentially three serialization mechanisms in play (java.io,
Writable, GSON) and want to rationalize them. Is GSON still needed?

GSON is useful as an inspectable serialization. Avro would perhaps be preferable but Writable and java native serialization are not because of the need to inspect models using non java languages.

I am very sympathetic about the desire to rationalize these but the way forward that I see is avro since it serves the purposes of the other options. In particular, with large models gson begins to eat up vast amounts of transient heap space when writing or reading. Avro would avoid this.

(Could well be) 'transient' doesn't have meaning for Writable, though
I take the point about annotation. But an annotation or comment could
be a better thing. 'transient' in a non-Serializable class looks at
first like a mistake.

Except where it is meaningful to the compiler, I agree that transient is less than perspicuous. Where it is used only for GSON there should always be a comment about why.


On Wed, Sep 22, 2010 at 2:19 PM, Jeff Eastman
<[email protected]> wrote:
 On 9/22/10 3:16 AM, Sean Owen wrote:

Someone remind me about why we use 'transient' in the code?

It has no meaning outside of java.io.Serializable, and customizing its
behavior. It's not seen in non-Serializable classes.
But, I remember someone commented at one point that it has meaning for
the GSON serialization mechanism. True?

If so, is there a sense of which classes that affects? since I see it
in classes I don't think would ever be serialized like OnlineAuc.

Yes, Gson will not serialize transient state. It's also a reasonable way to
indicate transient state that is not serialized by Writable. See
AbstractCluster for an example.

Reply via email to