public boolean isStopped() {
synchronized (this) {
- return stopped || (scheduledNextStep.isEmpty() && scheduledAt.isEmpty());
+ return stopped;
}
}
SCLContext context = SCLContext.getCurrent();
Object oldActionContext = context.put("sequenceAction", this);
try {
- Task firstTask = scheduledAt.peek();
while(true) {
while(!scheduledNow.isEmpty()) {
try {
this.exceptions.add(new RuntimeException("Action failure at " + currentTime + ": " + e.getMessage(), e));
}
}
- if(firstTask == null)
+ Task firstTask = scheduledAt.peek();
+ if(firstTask == null) {
+ if (scheduledNextStep.isEmpty())
+ stopped = true;
return Double.POSITIVE_INFINITY;
- else if(firstTask.time > currentTime+TIME_TOLERANCE)
+ } else if(firstTask.time > currentTime+TIME_TOLERANCE) {
return firstTask.time;
- else {
+ } else {
+ scheduledAt.remove();
firstTask.continuation.apply(Tuple0.INSTANCE);
- synchronized (this) {
- scheduledAt.remove();
- }
- firstTask = scheduledAt.peek();
}
}
} finally {