Github user revans2 commented on a diff in the pull request: https://github.com/apache/storm/pull/2502#discussion_r159969475 --- Diff: storm-client/src/jvm/org/apache/storm/utils/Utils.java --- @@ -328,20 +328,22 @@ public static boolean isSystemId(String id) { * @return the newly created thread * @see Thread */ - public static SmartThread asyncLoop(final Callable afn, - boolean isDaemon, final Thread.UncaughtExceptionHandler eh, - int priority, final boolean isFactory, boolean startImmediately, - String threadName) { + public static SmartThread asyncLoop(final Callable afn, boolean isDaemon, final Thread.UncaughtExceptionHandler eh, + int priority, final boolean isFactory, boolean startImmediately, + String threadName) { SmartThread thread = new SmartThread(new Runnable() { public void run() { - Object s; try { - Callable fn = isFactory ? (Callable) afn.call() : afn; - while ((s = fn.call()) instanceof Long) { - Time.sleepSecs((Long) s); + final Callable<Long> fn = isFactory ? (Callable<Long>) afn.call() : afn; + while (true) { + final Long s = fn.call(); + if (s==null) // then stop running it + break; + if (s>0) + Thread.sleep(s); --- End diff -- This needs to be Time.sleep if we want simulated time to work properly....
---