Well, I am not a Terracotta pro. But have at least a little bit of
experience with it.
But I think the problem could be true for the same for other clustering
solutions, too.

Terracotta is able to keep object identity within different clustered
VMs. It is necessary to define root objects that are shared over the
cluster. All referenced objects are shared too.
So if a root contains a references to a DateTime object, that object is
transferred to the other VMs. 

But as I see, each DateTime object holds some references to
DateTimeFieldType. Those are transfered too. But of course those objects
are not the same as the objects that are stored within the static fields
of the class DateTimeFieldType.


Now there exist three approaches to solve that issue:
- Don't compare objects using ==. I know that this is not perfect, but
for me it was a very simple solution... But ok, I think that is not the
way to go.
- Share the static fields: I tried this successfully. But of course the
performance is very, very poor. Every time a static field of
DateTimeFieldType is accessed, that field is locked in the hole cluster.
So obviously this is not a possible solution.
- Reinitializing the date time objects: It is possible to call methods
or execute bean shell code, when an object is transferred to another
VM. 
Can you tell me a way how those references could be updated to the
correct one? I think it is necessary to reinitialize all fields that are
compared using == with the values stored in the static fields.
If that is possible, everything should work as expected. 

And since DateTime is Serializable I think there might be a way...


I think that Joda is a great API (thanks for your work). And I think
that Terracotta is a great product, too. I would like to see them work
together.

Maybe it is possible for one of the Joda gurus to mail directly with one
of the Terracotty guys? I may convey...
I have also created a small sample application that can be used to test
several solutions. If necessary, I will improve that and help to detect
problems.



Regards,

Johannes Schneider

On Thu, 2008-03-27 at 16:31 +0000, Stephen Colebourne wrote:
> There are lots of places in Joda-Time where we rely on == rather than
> .equals(). This patch certainly won't be sufficient to fix all those
> places.
> 
> In order to change Joda-Time to solve an issue like this I would need
> proof (eg. someone from Terracotta) saying that this cannot be fixed
> by a change in the Terracotta setup. Basically, comparing objects
> using == is a fundamental Java concept, and a tool like Terracotta
> really needs to support it.
> 
> Stephen
> 
> 
> On 26/03/2008, Johannes Schneider <[EMAIL PROTECTED]> wrote:
> > Okay,
> >
> >  I have created a small patch that seems to fix my problems. It can be
> >  downloaded at
> >  http://cedarsoft.de/tmp/terracotta_compatibility_patch.patch
> >
> >  I am not sure whether that is enough for terracotta support, but for me
> >  it works so far.
> >  And I don't understand whether I have added a pitfall to Joda time.
> >
> >  The problem is that
> >  org.joda.time.base.AbstractPartial#compareTo
> >  compares the field types using "!=" but when using a cluster those
> >  instances are not identical.
> >  So I have added a simple "equals" method to
> >  org.joda.time.DateTimeFieldType.StandardDateTimeFieldType.
> >
> >
> >  At the moment I use that patched version successfully. It would be great
> >  if anyone could take a look at that patch and give some comments whether
> >  that is a valid change that could be added to the trunk.
> 
> -------------------------------------------------------------------------
> 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
> Joda-interest@lists.sourceforge.net
> 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
Joda-interest@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/joda-interest

Reply via email to