< prev index next >

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

Print this page

1523      * that is, it does not complete either normally or abruptly.
1524      * <p>
1525      * The argument serves as a status code. By convention, a nonzero status code
1526      * indicates abnormal termination.
1527      * <p>
1528      * The call {@code System.exit(n)} is effectively equivalent to the call:
1529      * {@snippet :
1530      *     Runtime.getRuntime().exit(n)
1531      * }
1532      *
1533      * @implNote
1534      * The initiation of the shutdown sequence is logged by {@link Runtime#exit(int)}.
1535      *
1536      * @param  status exit status.
1537      * @see    java.lang.Runtime#exit(int)
1538      */
1539     public static void exit(int status) {
1540         Runtime.getRuntime().exit(status);
1541     }
1542 













1543     /**
1544      * Runs the garbage collector in the Java Virtual Machine.
1545      * <p>
1546      * Calling the {@code gc} method suggests that the Java Virtual Machine
1547      * expend effort toward recycling unused objects in order to
1548      * make the memory they currently occupy available for reuse
1549      * by the Java Virtual Machine.
1550      * When control returns from the method call, the Java Virtual Machine
1551      * has made a best effort to reclaim space from all unused objects.
1552      * There is no guarantee that this effort will recycle any particular
1553      * number of unused objects, reclaim any particular amount of space, or
1554      * complete at any particular time, if at all, before the method returns or ever.
1555      * There is also no guarantee that this effort will determine
1556      * the change of reachability in any particular number of objects,
1557      * or that any particular number of {@link java.lang.ref.Reference Reference}
1558      * objects will be cleared and enqueued.
1559      *
1560      * <p>
1561      * The call {@code System.gc()} is effectively equivalent to the
1562      * call:

1523      * that is, it does not complete either normally or abruptly.
1524      * <p>
1525      * The argument serves as a status code. By convention, a nonzero status code
1526      * indicates abnormal termination.
1527      * <p>
1528      * The call {@code System.exit(n)} is effectively equivalent to the call:
1529      * {@snippet :
1530      *     Runtime.getRuntime().exit(n)
1531      * }
1532      *
1533      * @implNote
1534      * The initiation of the shutdown sequence is logged by {@link Runtime#exit(int)}.
1535      *
1536      * @param  status exit status.
1537      * @see    java.lang.Runtime#exit(int)
1538      */
1539     public static void exit(int status) {
1540         Runtime.getRuntime().exit(status);
1541     }
1542 
1543     /**
1544      * Returns whether the AOT system is recording training data.
1545      * @return whether the AOT system is recording training data.
1546      * @since 25
1547      */
1548     public static native boolean AOTIsTraining();
1549 
1550     /**
1551      * Will stop the recording of AOT training data.
1552      * @since 25
1553      */
1554     public static native void AOTEndTraining();
1555 
1556     /**
1557      * Runs the garbage collector in the Java Virtual Machine.
1558      * <p>
1559      * Calling the {@code gc} method suggests that the Java Virtual Machine
1560      * expend effort toward recycling unused objects in order to
1561      * make the memory they currently occupy available for reuse
1562      * by the Java Virtual Machine.
1563      * When control returns from the method call, the Java Virtual Machine
1564      * has made a best effort to reclaim space from all unused objects.
1565      * There is no guarantee that this effort will recycle any particular
1566      * number of unused objects, reclaim any particular amount of space, or
1567      * complete at any particular time, if at all, before the method returns or ever.
1568      * There is also no guarantee that this effort will determine
1569      * the change of reachability in any particular number of objects,
1570      * or that any particular number of {@link java.lang.ref.Reference Reference}
1571      * objects will be cleared and enqueued.
1572      *
1573      * <p>
1574      * The call {@code System.gc()} is effectively equivalent to the
1575      * call:
< prev index next >