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

(refs) java.lang.Runtime.runFinalizersOnExit only has effect when exit code is 0

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P5
    • Resolution: Won't Fix
    • Affects Version/s: 1.1, 1.2.0
    • Fix Version/s: None
    • Component/s: hotspot
    • Subcomponent:
    • CPU:
      x86, sparc
    • OS:
      solaris_2.5, windows_nt

      Description



      Name: mc57594 Date: 02/12/97


      The following program produces different results depending
      on what exit code is passed in:

      public
      class tt {
        static foo Foo = null;

        static public void main(String argv[]) {
          System.runFinalizersOnExit(true);
          new foo(1);
          Foo = new foo(2);
          System.exit(Integer.parseInt(argv[0]));
        }

      }

      class foo {
        int ii;
        foo(int i) {
          ii = i;
          System.out.println("foo(" + i + ") called");
        }
        protected void finalize() {
          System.out.println("finalize called on " + ii);
        }
      }

      D:\temp>java tt 0
      foo(1) called
      foo(2) called
      finalize called on 1
      finalize called on 2

      D:\temp>java tt 1
      foo(1) called
      foo(2) called

      If this is intentional, then it should be documented. It would
      be nice if the finalization code was run, no matter what the
      exit value is.

      company - Object Design, Inc. , email - ###@###.###
      ======================================================================

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                mr Mark Reinhold
                Reporter:
                mchamnessunw Mark Chamness (Inactive)
              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Imported:
                  Indexed: