diff --git a/src/main/java/org/orekit/time/BurstSelector.java b/src/main/java/org/orekit/time/BurstSelector.java index 85478f2e5335e43072759c040ea2b81d19632f23..967c44fbcc3f74a5e15f55be704421584a9023b9 100644 --- a/src/main/java/org/orekit/time/BurstSelector.java +++ b/src/main/java/org/orekit/time/BurstSelector.java @@ -29,6 +29,11 @@ import org.hipparchus.util.FastMath; * {@link org.orekit.time.TimeScalesFactory#getUTC() UTC}, the first date of * each burst will occur at whole hours in UTC time. * </p> + * <p> + * This class stores internally the last selected dates, so it is <em>not</em> + * thread-safe. A separate selector should be used for each thread in multi-threading + * context. + * </p> * @author Luc Maisonobe * @since 9.3 */ @@ -91,17 +96,16 @@ public class BurstSelector implements DatesSelector { final List<AbsoluteDate> selected = new ArrayList<>(); - boolean reset = first == null || start.durationFrom(first) > burstPeriod; + final boolean reset = first == null || start.durationFrom(first) > burstPeriod; + if (reset) { + first = null; + lastSize = 0; + } + for (AbsoluteDate next = reset ? start : last.shiftedBy(highRateStep); next.compareTo(end) <= 0; next = last.shiftedBy(highRateStep)) { - if (reset) { - first = null; - lastSize = 0; - reset = false; - } - if (lastSize == maxBurstSize) { // we have exceeded burst size, jump to next burst next = first.shiftedBy(burstPeriod); diff --git a/src/main/java/org/orekit/time/FixedStepSelector.java b/src/main/java/org/orekit/time/FixedStepSelector.java index 40c3c80548db9089f9957438f5d44f67fbe13e9b..a6ec74d3af9dc71db412a6c8728cbdad627e261f 100644 --- a/src/main/java/org/orekit/time/FixedStepSelector.java +++ b/src/main/java/org/orekit/time/FixedStepSelector.java @@ -29,6 +29,11 @@ import org.hipparchus.util.FastMath; * {@link org.orekit.time.TimeScalesFactory#getUTC() UTC}, dates will be selected * at whole minutes in UTC time. * </p> + * <p> + * This class stores internally the last selected dates, so it is <em>not</em> + * thread-safe. A separate selector should be used for each thread in multi-threading + * context. + * </p> * @author Luc Maisonobe * @since 9.3 */