Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4335279

(linux) method Object.wait() does not work

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P3
    • Resolution: Fixed
    • Affects Version/s: 1.3.0
    • Fix Version/s: 1.3.0
    • Component/s: core-libs
    • Labels:
    • Subcomponent:
    • Resolved In Build:
      linux-beta
    • CPU:
      x86
    • OS:
      linux
    • Verification:
      Verified

      Description



      Name: skR10017 Date: 05/03/2000



      Java 2 Platform SE v1.3 Specification reads about java.lang.Object.wait() method:

      public final void wait()
                      throws InterruptedException

            Causes current thread to wait until another thread invokes the notify() method
            or the notifyAll() method for this object. In other word's this method behaves
            exactly as if it simply performs the call wait(0).
      ---------------------------------------------------------------------------------

      The following test shows incorrect behavior of Object.wait() method,
      this method terminates immediately without notify() method invocation.

      This test fails only in Java HotSpot(TM) Client VM (build 1.3.0beta-b01, mixed mode) for linux.
      The following list of JCK1.3 tests fails by the same reason:
        1. api/java_lang/Object/desc.html#Wait
        2. api/java_lang/Object/desc.html#Notify
        3. api/java_lang/Object/desc.html#NotifyAll

      --------------------------test.java------------------------------
      public class test {

        public synchronized void getState() {

          System.out.println("Waiting is started");
          try {
              wait();
          } catch( InterruptedException e ) {
          }

          System.out.println("Waiting is finished");
        }

        public static void main( String[] argv ) {
          new test().getState();
        }
      }
      ------------------------------------------------------------------

      Please note that if you use wait(n) where n is greater than zero instead of wait()
      the test won't fail on linux.

      The test passes if only "Waiting is started" is printed
      and then test is blocked in wait() method until user interrupts it with Ctrl+C

      -----------------------------output--------------------------
      Linux:

      [kotl@linux-4 Object]$ java test
      Waiting is started
      Waiting is finished
      [kotl@linux-4 Object]$

      Solaris:

      bash-2.00$ java test
      Waiting is started
      ^C
      bash-2.00$


      --------------------------------------------------------------

      ======================================================================

      Name: kaC94536 Date: 05/11/2000



      The bug is reproducible under jdk1.3.0beta-bo4 in Xcomp mode

      ======================================================================

        Attachments

          Activity

            People

            Assignee:
            hongzh Hong Zhang
            Reporter:
            kotlsunw Kotl Kotl (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: