[threeten-dev] Review updates to support multiple Hijrah deviations
Roger Riggs
Roger.Riggs at Oracle.com
Sun Dec 23 14:59:46 PST 2012
Hi,
This review addresses some of the issues in #95 Deviation Options for
the Hijrah Calendar <https://github.com/ThreeTen/threeten/issues/95>
Please review and comment on:
http://cr.openjdk.java.net/~rriggs/webrev-deviations/
The changes include refactoring the support for the deviations into the
Chrono class
from the HijrahDate class. The change includes changing HijrahDate so
that it refers
explicitly to an instance of HijrahChrono. Changes to HijrahChrono
include multiple
instances with different Ids and calendarTypes that encapsulate the
different deviations.
Each acts as a different calendar. The serialized form of HijrahDate
includes the reference
to the HijrahChrono instance (already serialized as represented by the id).
The format of the deviation file is modified to use ISO dates which are
converted to
HijrahDates using the default Islamic calendar. The offsets modify the
length of the
HijrahMonths for the alternate calendar.
The configuration mechanism for the deviation options is not final.
System properties
identify the additional Hijrah calendars; and the default location of
the deviation files
which are named according to the calendar id.
The additional calendars are created when the standard Hijrah calendar
is initialized.
These changes also exposed a flaw in the registration mechanism used for
Chrono.of(id);
the registration was being done before the constructor of the Chrono was
complete
allowing incompletely constructed Chronos to be visible to other threads.
A separate registerChrono method was added that is the last thing called in
the subclasses constructor.
There may be a better initialization sequence but it cannot involve
recursion between
the static initializers and the constructors.
Happy Holidays, Roger
More information about the threeten-dev
mailing list