[concurrency-interest] Joda-Time immutability

Stephen Colebourne scolebourne at joda.org
Mon Jun 20 19:43:47 EDT 2011


On 20 June 2011 20:26, Eamonn McManus <eamonn.mcmanus at oracle.com> wrote:
> I would suggest mirroring the mutable fields in BaseDateTime with final
> fields in DateTime. Since existing serialized instances of DateTime will not
> have these fields, you will need a readResolve method to set them in that
> case. In order for serialized instances of the new DateTime to work with
> older versions, you just need to set the BaseDateTime fields as well.

This approach would probably work, but would double the memory usage
of the common immutable case. I don't mind doubling the memory in the
mutable case, and I may just have to (breaking the mutable
serialization too)

Stephen


More information about the Concurrency-interest mailing list