< prev index next >

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

Print this page

1624      * that is, it does not complete either normally or abruptly.
1625      * <p>
1626      * The argument serves as a status code. By convention, a nonzero status code
1627      * indicates abnormal termination.
1628      * <p>
1629      * The call {@code System.exit(n)} is effectively equivalent to the call:
1630      * {@snippet :
1631      *     Runtime.getRuntime().exit(n)
1632      * }
1633      *
1634      * @implNote
1635      * The initiation of the shutdown sequence is logged by {@link Runtime#exit(int)}.
1636      *
1637      * @param  status exit status.
1638      * @see    java.lang.Runtime#exit(int)
1639      */
1640     public static void exit(int status) {
1641         Runtime.getRuntime().exit(status);
1642     }
1643 












1644     /**
1645      * Runs the garbage collector in the Java Virtual Machine.
1646      * <p>
1647      * Calling the {@code gc} method suggests that the Java Virtual Machine
1648      * expend effort toward recycling unused objects in order to
1649      * make the memory they currently occupy available for reuse
1650      * by the Java Virtual Machine.
1651      * When control returns from the method call, the Java Virtual Machine
1652      * has made a best effort to reclaim space from all unused objects.
1653      * There is no guarantee that this effort will recycle any particular
1654      * number of unused objects, reclaim any particular amount of space, or
1655      * complete at any particular time, if at all, before the method returns or ever.
1656      * There is also no guarantee that this effort will determine
1657      * the change of reachability in any particular number of objects,
1658      * or that any particular number of {@link java.lang.ref.Reference Reference}
1659      * objects will be cleared and enqueued.
1660      *
1661      * <p>
1662      * The call {@code System.gc()} is effectively equivalent to the
1663      * call:

1624      * that is, it does not complete either normally or abruptly.
1625      * <p>
1626      * The argument serves as a status code. By convention, a nonzero status code
1627      * indicates abnormal termination.
1628      * <p>
1629      * The call {@code System.exit(n)} is effectively equivalent to the call:
1630      * {@snippet :
1631      *     Runtime.getRuntime().exit(n)
1632      * }
1633      *
1634      * @implNote
1635      * The initiation of the shutdown sequence is logged by {@link Runtime#exit(int)}.
1636      *
1637      * @param  status exit status.
1638      * @see    java.lang.Runtime#exit(int)
1639      */
1640     public static void exit(int status) {
1641         Runtime.getRuntime().exit(status);
1642     }
1643 
1644     /**
1645      * Returns whether the AOT system is recording training data.
1646      *
1647      * @return  whether the AOT system is recording training data.
1648      */
1649     public static native boolean AOTIsTraining();
1650 
1651     /**
1652      * Will stop the recording of AOT training data.
1653      */
1654     public static native void AOTEndTraining();
1655 
1656     /**
1657      * Runs the garbage collector in the Java Virtual Machine.
1658      * <p>
1659      * Calling the {@code gc} method suggests that the Java Virtual Machine
1660      * expend effort toward recycling unused objects in order to
1661      * make the memory they currently occupy available for reuse
1662      * by the Java Virtual Machine.
1663      * When control returns from the method call, the Java Virtual Machine
1664      * has made a best effort to reclaim space from all unused objects.
1665      * There is no guarantee that this effort will recycle any particular
1666      * number of unused objects, reclaim any particular amount of space, or
1667      * complete at any particular time, if at all, before the method returns or ever.
1668      * There is also no guarantee that this effort will determine
1669      * the change of reachability in any particular number of objects,
1670      * or that any particular number of {@link java.lang.ref.Reference Reference}
1671      * objects will be cleared and enqueued.
1672      *
1673      * <p>
1674      * The call {@code System.gc()} is effectively equivalent to the
1675      * call:
< prev index next >