< prev index next >

src/java.base/share/classes/java/lang/Runtime.java

Print this page

 669      * means of invoking this method.
 670      */
 671     public native void gc();
 672 
 673     /**
 674      * Runs the finalization methods of any objects pending finalization.
 675      * Calling this method suggests that the Java virtual machine expend
 676      * effort toward running the {@code finalize} methods of objects
 677      * that have been found to be discarded but whose {@code finalize}
 678      * methods have not yet been run. When control returns from the
 679      * method call, the virtual machine has made a best effort to
 680      * complete all outstanding finalizations.
 681      * <p>
 682      * The virtual machine performs the finalization process
 683      * automatically as needed, in a separate thread, if the
 684      * {@code runFinalization} method is not invoked explicitly.
 685      * <p>
 686      * The method {@link System#runFinalization()} is the conventional
 687      * and convenient means of invoking this method.
 688      *







 689      * @see     java.lang.Object#finalize()

 690      */

 691     public void runFinalization() {
 692         SharedSecrets.getJavaLangRefAccess().runFinalization();
 693     }
 694 
 695     /**
 696      * Loads the native library specified by the filename argument.  The filename
 697      * argument must be an absolute path name.
 698      * (for example
 699      * {@code Runtime.getRuntime().load("/home/avh/lib/libX11.so");}).
 700      *
 701      * If the filename argument, when stripped of any platform-specific library
 702      * prefix, path, and file extension, indicates a library whose name is,
 703      * for example, L, and a native library called L is statically linked
 704      * with the VM, then the JNI_OnLoad_L function exported by the library
 705      * is invoked rather than attempting to load a dynamic library.
 706      * A filename matching the argument does not have to exist in the file
 707      * system.
 708      * See the <a href="{@docRoot}/../specs/jni/index.html"> JNI Specification</a>
 709      * for more details.
 710      *

 669      * means of invoking this method.
 670      */
 671     public native void gc();
 672 
 673     /**
 674      * Runs the finalization methods of any objects pending finalization.
 675      * Calling this method suggests that the Java virtual machine expend
 676      * effort toward running the {@code finalize} methods of objects
 677      * that have been found to be discarded but whose {@code finalize}
 678      * methods have not yet been run. When control returns from the
 679      * method call, the virtual machine has made a best effort to
 680      * complete all outstanding finalizations.
 681      * <p>
 682      * The virtual machine performs the finalization process
 683      * automatically as needed, in a separate thread, if the
 684      * {@code runFinalization} method is not invoked explicitly.
 685      * <p>
 686      * The method {@link System#runFinalization()} is the conventional
 687      * and convenient means of invoking this method.
 688      *
 689      * @deprecated Finalization has been deprecated for removal.  See
 690      * {@link java.lang.Object#finalize} for background information and details
 691      * about migration options.
 692      * <p>
 693      * When running in a JVM in which finalization has been disabled or removed,
 694      * no objects will be pending finalization, so this method does nothing.
 695      *
 696      * @see     java.lang.Object#finalize()
 697      * @jls 12.6 Finalization of Class Instances
 698      */
 699     @Deprecated(since="18", forRemoval=true)
 700     public void runFinalization() {
 701         SharedSecrets.getJavaLangRefAccess().runFinalization();
 702     }
 703 
 704     /**
 705      * Loads the native library specified by the filename argument.  The filename
 706      * argument must be an absolute path name.
 707      * (for example
 708      * {@code Runtime.getRuntime().load("/home/avh/lib/libX11.so");}).
 709      *
 710      * If the filename argument, when stripped of any platform-specific library
 711      * prefix, path, and file extension, indicates a library whose name is,
 712      * for example, L, and a native library called L is statically linked
 713      * with the VM, then the JNI_OnLoad_L function exported by the library
 714      * is invoked rather than attempting to load a dynamic library.
 715      * A filename matching the argument does not have to exist in the file
 716      * system.
 717      * See the <a href="{@docRoot}/../specs/jni/index.html"> JNI Specification</a>
 718      * for more details.
 719      *
< prev index next >