I forced Terracotta to share all static fields within
org.joda.time.DateTimeFieldType.
Without that the methods "isAfter", "isBefore" etc. fail with that
exception:

 Exception in thread "Thread-12" java.lang.ClassCastException:
ReadablePartial objects must have matching field types
[INFO] [client]         at
org.joda.time.base.AbstractPartial.compareTo(AbstractPartial.java:325)
[INFO] [client]         at
org.joda.time.LocalDate.compareTo(LocalDate.java:566)
[INFO] [client]         at
org.joda.time.base.AbstractPartial.isBefore(AbstractPartial.java:381)


The problem is that the DateTimeFields are cached using static fields
within DateTimeFieldType.
While Terracotta is able to transfer the DateTime object to the other
JVM, the static fields are different on each of those VMs.
So comparisons using "==" fail....

So maybe that could/should be fixed? Do you have an idea how that could
be achieved?


Regards,

Johannes Schneider

On Wed, 2008-03-26 at 08:41 -0700, Brian S O'Neill wrote:
> It looks like Terracotta is sharing things that aren't intended to be 
> shared. The time zone cache is just a performance optimization for the 
> local JVM. How can you instruct Terracotta not to share this? I have no 
> experience with Terracotta.
> 
> The only amount of sharing which was anticipated was serialization of 
> the top-level objects, like DateTime. These objects serialize the 
> minimum amount of data and no runtime state. Put another way, Joda-Time 
> deals with small data objects, and only data is intended to be shared. 
> Is Terracotta trying to share the entire Joda-Time runtime? This does 
> not make sense.
> 
> Johannes Schneider wrote:
> > Hi,
> >
> > I run into big performance problems regarding Joda and Terracotta (a
> > clustering solution).
> > At the moment I don't have any ideas how to solve that. Maybe anybody
> > has any experiences with Joda and Terracotta?
> >
> > I have created a small micro benchmark to test that. It can be found at
> > the Terracotta forums
> > (http://forums.terracotta.org/forums/posts/list/0/903.page#5537).
> >
> > The main problem is that it seems to be necessary to add the following
> > fields as root:
> >
> >       <roots>
> >         <root>
> >           <field-expression>private static final
> > org.joda.time.DateTimeFieldType
> > org.joda.time.DateTimeFieldType.*</field-expression>
> >         </root>
> >       </roots>
> >
> > If I don't add that root the methods #isAfter() #isBefore #isEquals
> > don't work as expected.
> >
> > And therefore it is necessary to add locking for those methods:
> >
> >         <autolock auto-synchronized="true">
> >           <method-expression>*
> > org.joda.time.tz.CachedDateTimeZone.get*(..)</method-expression>
> >           <lock-level>write</lock-level>
> >         </autolock>
> >         <autolock auto-synchronized="true">
> >           <method-expression>*
> > org.joda.time.chrono.BasicChronology.get*(..)</method-expression>
> >           <lock-level>write</lock-level>
> >         </autolock>
> >
> >
> > But locking those methods on the hole cluster results in a major
> > performance impact when working with Joda objects.
> >
> > If anyone can give me any hint or comment, that will be great. At the
> > moment I am thinking about removing Joda Time completely from the
> > cluster and only do local calculations with Joda. But that means a lot
> > of work and I really don't wanna miss Joda time...
> >
> >
> >
> > Regards,
> >
> > Johannes Schneider
> >
> >   
> > ------------------------------------------------------------------------
> >
> > -------------------------------------------------------------------------
> > Check out the new SourceForge.net Marketplace.
> > It's the best place to buy or sell services for
> > just about anything Open Source.
> > http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
> > ------------------------------------------------------------------------
> >
> > _______________________________________________
> > Joda-interest mailing list
> > [email protected]
> > https://lists.sourceforge.net/lists/listinfo/joda-interest
> >   
> 
> -------------------------------------------------------------------------
> Check out the new SourceForge.net Marketplace.
> It's the best place to buy or sell services for
> just about anything Open Source.
> http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
> _______________________________________________
> Joda-interest mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/joda-interest
-- 
Johannes Schneider
Im Lindenwasen 15
72810 Gomaringen

Fon +49 7072 9229972
Fax +49 7072 509999
Mobil +49 178 1364488

[EMAIL PROTECTED]
http://www.johannes-schneider.info

Attachment: smime.p7s
Description: S/MIME cryptographic signature

-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
_______________________________________________
Joda-interest mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/joda-interest

Reply via email to