jakarta-jcs-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mitch Gorman <gor...@sportsline.com>
Subject Re: Serializing question about JCS in a Lateral Cache config
Date Wed, 31 Aug 2005 21:46:10 GMT

> 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.

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message