public TailCall processLeavingTail(final XPathContext context) throws XPathException {
IntegerValue time = (IntegerValue)wait.evaluateItem(context);
final CallTemplate.CallTemplatePackage pack = (CallTemplate.CallTemplatePackage)call.processLeavingTail(context);
Timer t = new Timer() {
public void run() {
//Window.setTitle("Timer fired " + serial++);
boolean success = false;
logger.fine("processing ixsl:schedule-action");
if (LogConfiguration.loggingIsEnabled() && LogController.traceIsEnabled()) {
LogController.openTraceListener();
}
try {
TailCall tc = pack.processLeavingTail();
while (tc != null) {
tc = tc.processLeavingTail();
}
context.getController().getPendingUpdateList().apply(context);
success = true;
} catch (Exception err) {
logger.log(Level.SEVERE, "In delayed event: " + err.getMessage());
if (SaxonceApi.doThrowJsExceptions()) {
throw new RuntimeException(err.getMessage());
}
}
if (LogConfiguration.loggingIsEnabled() && LogController.traceIsEnabled()) {
LogController.closeTraceListener(success);
}
}
};
//Window.setTitle("Timer started " + serial + " (time " + time + "ms)");
t.schedule(time.getIntValue());
return null;
}