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

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



Thomas Neidhart <thomas.neidhart@gmail.com> a écrit :

On 04/14/2012 05:31 PM, MAISONOBE Luc wrote:

OK. As you have already done it locally, could you commit the patch ?

[snip]

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.

Thanks, I'll look at this tomorrow.


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?

A reflection-based test seems good to me. It is well suited for tests and does not clutter the public API with something that is mainly an implementation detail.


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

Thank you for that.


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.

You are perfectly right and this is the way to go.

best regards,
Luc


Thomas





----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.