< prev index next >

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

Print this page

1501      * that is, it does not complete either normally or abruptly.
1502      * <p>
1503      * The argument serves as a status code. By convention, a nonzero status code
1504      * indicates abnormal termination.
1505      * <p>
1506      * The call {@code System.exit(n)} is effectively equivalent to the call:
1507      * {@snippet :
1508      *     Runtime.getRuntime().exit(n)
1509      * }
1510      *
1511      * @implNote
1512      * The initiation of the shutdown sequence is logged by {@link Runtime#exit(int)}.
1513      *
1514      * @param  status exit status.
1515      * @see    java.lang.Runtime#exit(int)
1516      */
1517     public static void exit(int status) {
1518         Runtime.getRuntime().exit(status);
1519     }
1520 












1521     /**
1522      * Runs the garbage collector in the Java Virtual Machine.
1523      * <p>
1524      * Calling the {@code gc} method suggests that the Java Virtual Machine
1525      * expend effort toward recycling unused objects in order to
1526      * make the memory they currently occupy available for reuse
1527      * by the Java Virtual Machine.
1528      * When control returns from the method call, the Java Virtual Machine
1529      * has made a best effort to reclaim space from all unused objects.
1530      * There is no guarantee that this effort will recycle any particular
1531      * number of unused objects, reclaim any particular amount of space, or
1532      * complete at any particular time, if at all, before the method returns or ever.
1533      * There is also no guarantee that this effort will determine
1534      * the change of reachability in any particular number of objects,
1535      * or that any particular number of {@link java.lang.ref.Reference Reference}
1536      * objects will be cleared and enqueued.
1537      *
1538      * <p>
1539      * The call {@code System.gc()} is effectively equivalent to the
1540      * call:

1501      * that is, it does not complete either normally or abruptly.
1502      * <p>
1503      * The argument serves as a status code. By convention, a nonzero status code
1504      * indicates abnormal termination.
1505      * <p>
1506      * The call {@code System.exit(n)} is effectively equivalent to the call:
1507      * {@snippet :
1508      *     Runtime.getRuntime().exit(n)
1509      * }
1510      *
1511      * @implNote
1512      * The initiation of the shutdown sequence is logged by {@link Runtime#exit(int)}.
1513      *
1514      * @param  status exit status.
1515      * @see    java.lang.Runtime#exit(int)
1516      */
1517     public static void exit(int status) {
1518         Runtime.getRuntime().exit(status);
1519     }
1520 
1521     /**
1522      * Returns whether the AOT system is recording training data.
1523      *
1524      * @return  whether the AOT system is recording training data.
1525      */
1526     public static native boolean AOTIsTraining();
1527 
1528     /**
1529      * Will stop the recording of AOT training data.
1530      */
1531     public static native void AOTEndTraining();
1532 
1533     /**
1534      * Runs the garbage collector in the Java Virtual Machine.
1535      * <p>
1536      * Calling the {@code gc} method suggests that the Java Virtual Machine
1537      * expend effort toward recycling unused objects in order to
1538      * make the memory they currently occupy available for reuse
1539      * by the Java Virtual Machine.
1540      * When control returns from the method call, the Java Virtual Machine
1541      * has made a best effort to reclaim space from all unused objects.
1542      * There is no guarantee that this effort will recycle any particular
1543      * number of unused objects, reclaim any particular amount of space, or
1544      * complete at any particular time, if at all, before the method returns or ever.
1545      * There is also no guarantee that this effort will determine
1546      * the change of reachability in any particular number of objects,
1547      * or that any particular number of {@link java.lang.ref.Reference Reference}
1548      * objects will be cleared and enqueued.
1549      *
1550      * <p>
1551      * The call {@code System.gc()} is effectively equivalent to the
1552      * call:
< prev index next >