Thanks, I had completely forgotten about the transient keyword. Haha..

That won't work for us in this case tho. Actually, Xstream would be the only
option for us, since some of our inner object are 3rd party closed-source.
:(

Ian.

-----Original Message-----
From: Mitch Gorman [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, August 31, 2005 5:46 PM
To: JCS Users List
Subject: Re: Serializing question about JCS in a Lateral Cache config



> The only objects we are putting into the cache are
> CqtRFQEstimateCollector
> and CqtEstimateEvent (both are Serializable). The objects mentioned in 
> these
> stacktraces (CqtRFQSpecQuote, CqtSupplierQuoteKey and ItcMoney) are 
> objects
> that are held within the CqtRFQEstimateCollector object, and are not
> Serializable. These exceptions do not make sense to me, since JCS 
> shouldn't
> even be trying to serialize these objects. Before I go ahead and start
> modifying more objects, I just wanted to make sure I'm doing things 
> right.
>

    If you declare an object as serializable, but it contains objects 
that are not serializable, you have to declare those objects transient. 

    transient CqtRFQSpecQuote specQuote = new CqtRFQSpecQuote("that's a 
godawful class name!");

    Then no attempt will be made to serialize those members of the 
CqtRFQEstimateCollector or CqtEstimateEvent classes, when they're 
serialized.  Obviously, then, they'd be null, when they're pulled out of 
the cache.  So, one way or another, you'll have to account for them:  
either make them (and any non-serializable objects *they* contain) 
serializable, or go through all the rest of your code making sure it 
won't NPE all over the place, when it uses an instance that's been cached.

Reply via email to