Uploaded image for project: 'Byteman'
  1. Byteman
  2. BYTEMAN-89

waitFor fails to timeout properly

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • 1.2.2.1
    • 1.2.2
    • Rule Helpers
    • None

      For some reason, I am not seeing waitFor timeout properly.

      See forum thread where I talk to myself about this issue

      http://community.jboss.org/message/535224

      Here's the patch:

      Index: Waiter.java
      ===================================================================
      — Waiter.java (revision 372)
      +++ Waiter.java (working copy)
      @@ -46,19 +46,22 @@
      public void waitFor(long millisecs)
      {
      long start = System.currentTimeMillis();

      • long waitFor = millisecs == 0 ? 0 : millisecs;
        + long waitForMillis = millisecs;
        synchronized(this) {
        waiting = true;
      • while (!signalled && waitFor >= 0){
        + while (!signalled && waitForMillis >= 0){
        try {
      • this.wait(waitFor);
        + if (waitForMillis == 0 && millisecs > 0) { + break; + }

        + this.wait(waitForMillis);
        } catch (InterruptedException e)

        { // ignore }

      if (!signalled)

      { - waitFor = millisecs == 0 ? 0 : millisecs + start - System.currentTimeMillis(); + waitForMillis = (millisecs == 0) ? 0 : millisecs + start - System.currentTimeMillis(); }

      }
      if (signalled) {

              jmazzitelli John Mazzitelli
              jmazzitelli John Mazzitelli
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Created:
                Updated:
                Resolved: