Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save mwkang/664a3b8efcc4e4a2f5abff2ab31debf5 to your computer and use it in GitHub Desktop.

Select an option

Save mwkang/664a3b8efcc4e4a2f5abff2ab31debf5 to your computer and use it in GitHub Desktop.
@Override
public int getProgress(InterpreterContext context) {
open();
return intp.getProgress(context);
}
@Override
public int progress() {
String replName = getRequiredReplName();
Interpreter repl = getRepl(replName);
if (repl != null) {
return repl.getProgress(getInterpreterContext(null));
} else {
return 0;
}
}
@Override
public void run() {
if (intervalMs < 0) {
return;
} else if (intervalMs == 0) {
intervalMs = DEFAULT_INTERVAL_MSEC;
}
while (terminate == false) {
JobListener listener = job.getListener();
if (listener != null) {
try {
if (job.isRunning()) {
listener.onProgressUpdate(job, job.progress());
}
} catch (Exception e) {
logger.error("Can not get or update progress", e);
}
}
try {
Thread.sleep(intervalMs);
} catch (InterruptedException e) {
logger.error("Exception in JobProgressPoller while run Thread.sleep", e);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment