On 14 Apr 2009, at 18:10, David M. Lloyd wrote:
On 04/14/2009 12:02 PM, Galder Zamarreno wrote:
>> I know this is jumping the gun a little, but how does this play
>> with ISPN-42: Object stream pooling? That's an optimisation I
>> would really like to see in place as soon as possible. :-) Is
>> this a trivial "extra" on top of ISPN-44?
> Since streams are now retrieved from a factory in JBoss
> Marshalling, I need to see what it happens behind the scenes (David
> could give us a hint here). He might be already doing pooling of
> the streams returned by the factory. If he isn't, since he's
> already implemented the factory, it might make more sense to
> implement it in JBMAR than in JBC? Otherwise, we can always
> implement this ourselves. David, thoughts?
Nope, the marshallers aren't pooled by default because they're very
lightweight to create (compared to Object*Streams). You can however
implement pooling if you want to (the start/finish methods exist for
this purpose). The potential benefit to pooling Marshaller/
Unmarshaller instances is that if you have Serializable objects
which have readObject/writeObject methods, the special Object*Stream
that is used to support this API is cached on the instance. I
haven't seen conclusive evidence that pooling would improve
performance overall though; because my Object*Streams completely
override the API, it doesn't have the same costs that are normally
associated with creating these objects (however there is still a
permission check involved).
Interesting. Maybe stream pooling will not be necessary at all then
if your streams are that much lighter/quicker to create.
--
Manik Surtani
manik(a)jboss.org
Lead, Infinispan
Lead, JBoss Cache
http://www.infinispan.org
http://www.jbosscache.org