Last active
August 9, 2016 04:15
-
-
Save mwkang/664a3b8efcc4e4a2f5abff2ab31debf5 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @Override | |
| public int getProgress(InterpreterContext context) { | |
| open(); | |
| return intp.getProgress(context); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @Override | |
| public int progress() { | |
| String replName = getRequiredReplName(); | |
| Interpreter repl = getRepl(replName); | |
| if (repl != null) { | |
| return repl.getProgress(getInterpreterContext(null)); | |
| } else { | |
| return 0; | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @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