use of com.swiftmq.swiftlet.timer.event.SystemTimeChangeListener in project swiftmq-ce by iitsoftware.
the class TimerSwiftletImpl method reorder.
private void reorder(long delta) {
if (traceSpace.enabled)
traceSpace.trace(getName(), "reorder, delta=" + delta + " ...");
logSwiftlet.logInformation(getName(), "System time has changed (delta=" + delta + "), reordering timer task queue");
List backup = (List) ((GapList) taskQueue).clone();
taskQueue.clear();
for (Iterator iter = backup.iterator(); iter.hasNext(); ) {
TimeTask t = (TimeTask) iter.next();
if (!t.doNotApplySystemTimeChanges) {
if (traceSpace.enabled)
traceSpace.trace(getName(), "reorder, before, t=" + t);
t.recalc(delta);
if (traceSpace.enabled)
traceSpace.trace(getName(), "reorder, after, t=" + t);
}
enqueue(t);
}
for (int i = 0; i < sysTimeChangeListeners.size(); i++) {
SystemTimeChangeListener l = null;
try {
l = (SystemTimeChangeListener) sysTimeChangeListeners.get(i);
l.systemTimeChangeDetected(delta);
} catch (Exception e) {
logSwiftlet.logInformation(getName(), "Exception calling SystemTimeChangeListener '" + l + "': " + e);
if (traceSpace.enabled)
traceSpace.trace(getName(), "Exception calling SystemTimeChangeListener '" + l + "': " + e);
}
}
if (traceSpace.enabled)
traceSpace.trace(getName(), "reorder, delta=" + delta + " done");
}
Aggregations