[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Orekit Developers] Work In Progress for thread safety

On 04/14/2012 05:31 PM, MAISONOBE Luc wrote:
> OK. As you have already done it locally, could you commit the patch ?


> I prefer the first method a lot. I think we may get the same problems
> for generators that are not single-shot, i.e. with more general cases
> (UTC-TAI was probably a bad choice for the first implementation, it is
> too specific).

done. I have committed the changes in Revision 95b77f65.

I have also added a unit test that uses reflection to check if the
internal cache of the UTCScale is working as intended.

The reasoning behind this was to keep the interface as it is (the cache
is private to the UTCScale), but we may find a different way to do it?

Additionally, I have done some cleanups after looking at findbugs and
checkstyle reports.

One thing that still bugs me a but it is that the TimeScales are
serializable, but this is imho dangerous, especially in the case of the
UTCScale. We could mark the cache field as transient, but this would
give users the wrong impression that it is safe to serialize a UTCScale,
which in fact is not true.

The correct way imo would be to make a UTCScale not serializable, and
when it is used in some class, mark it there as transient. In the
readObject method for this class, the UTCScale should be retrieved from
the TimeScalesFactory.