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

Re: [Orekit Developers] Multi-threading problems in OREKIT



On 02/20/2012 10:22 PM, MAISONOBE Luc wrote:

> Some work has been done on this topic and committed to the forge in a
> dedicated branch. See TimeStampedGenerator and TimeStampedCache. For
> now, no classes use these features.
> 
> We would be happy to get some feedback about this.

Dear Luc,

I have looked at the branch, very nice code as always ;-), but I have
some (minor) comments:

TimeStampedCache#ctor:

safeguard for maxSlots < 1

TimeStampedCache#selectSlot:

When a newly added slot is exceeding the maximum number of slots, the
slots array is (unnecessarily) resized. Increase the initial capacity by
1, or add the new slot not before the evicted one is removed.

Slot#entryIndex:

 This if is not safe, it can lead to an IndexOutOfBoundsException
 (actually I got one ;-):

 if (cache.get(guess + 1).getQuantum() > dateQuantum) {

 if the cache size is <= guess + 1, the entry is after the last entry

Slot#getNeighbor:

The way new entries are generated seems to have a bug. I have created
the following test. Create a cache with a generation step of 1hour, than
call twice getNeighbors with 1h apart dates:

TimeStampedCache<AbsoluteDate> cache = createCache(10, 3600.0, 13);

AbsoluteDate start = AbsoluteDate.GALILEO_EPOCH.shiftedBy(0);
cache.getNeighbors(start);
start = start.shiftedBy(3600);
cache.getNeighbors(start);

My expectations was to have 20 entries in the cache, but in fact there
were 26, and the center-date for the second call was at 12:30 instead of
01:00. Also it would be good to not create entries if it is not
necessary (they are already in the cache) as the generation may be
costly for some generators?


@Frames: To be compatible with this concept, a Frame object would also
implement the TimeStamped interface. There would be a cache for each
frame type, and when one wants to get the transformation between two
frames at a given time, the corresponding Frame objects would be
retrieved from the caches, and the transformation calculated. Do I
understand this correctly?

Thomas