Github user HeartSaVioR commented on a diff in the pull request:

    https://github.com/apache/storm/pull/2241#discussion_r129540613
  
    --- Diff: storm-client/src/jvm/org/apache/storm/utils/Utils.java ---
    @@ -323,20 +323,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);  // TODO: Roshan : need to do 
something about sleep strategy
    --- End diff --
    
    Use Time.sleepSecs() to be compatible with time simulation. And please 
check its unit was second, but unit is effectively changed to milliseconds in 
this change.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to