This project was the home of code used to develop a modern date and time library for JDK8. Development has moved to OpenJDK and a separate backport project, threetenbp.
The initial set of localized calendars had relatively light initializations, just creating the Chronology instance. As the Japanese and Hijrah Chronologies has been refined the amount of work needed to initialize the Chronology has increased. Reading the data for the Umm alQura calendar adds 30+ms to the initialization time.
Currently, the Chronology of, ofLocale, getAvailableChronologies all initialize all of the Chronologies to be able to return the complete set of Chronologies.
It would be better to initialize each Chronology only when it will be used by the application.
Two approaches are possible:
Change getAvailableChronologies to return the String ids of the chronologies and change the of method to initialize only the Chronology requested.
Change each of the heavyweight chronologies to create the Chronology instance as a quickly as possible and delay the reading of the data until it was needed. This may be more complex either by adding state within the Chronology or delegating to a separate class for the data.
Initially register a simple proxy for the Chronology that would initialize the data on first use and then replace itself in the list of registered Chronologies.
I don't think I overly care, although I'm naturally drawn to option 2. I think there may be an argument for changing getAvailableChronologies to return String anyway, as per ZoneId
The initial set of localized calendars had relatively light initializations, just creating the Chronology instance. As the Japanese and Hijrah Chronologies has been refined the amount of work needed to initialize the Chronology has increased. Reading the data for the Umm alQura calendar adds 30+ms to the initialization time.
Currently, the Chronology
of
,ofLocale
,getAvailableChronologies
all initialize all of the Chronologies to be able to return the complete set of Chronologies.It would be better to initialize each Chronology only when it will be used by the application. Two approaches are possible:
getAvailableChronologies
to return the Stringid
s of the chronologies and change theof
method to initialize only the Chronology requested.