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

Runtime.runFinalization() silently clears interrupted flag in the calling thread

XMLWordPrintable

    • b39
    • generic, x86
    • generic, linux, windows_nt
    • Verified

        Name: skT45625 Date: 07/19/2000


        java version "1.2.2"
        Classic VM (build JDK-1.2.2-004, native threads, symcjit)

        If the thread which is already interrupted by another thread, calls
        Runtime.getRuntime().runFinalization(), the interrupted status of the thread is
        cleared (and API documentation doesn't say anything about it).
        Sample code (my thread is already interrupted by another thread, before getting
        here):

        Runtime rt = Runtime.getRuntime();
        System.out.println("Status: "+ Thread.currentThread().isInterrupted());
        rt.runFinalization();
        System.out.println("Status: "+ Thread.currentThread().isInterrupted());

        will print to console:

        Status: true
        Status: false
        (Review ID: 107365)
        ======================================================================

              smarks Stuart Marks
              skondamasunw Suresh Kondamareddy (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              9 Start watching this issue

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: