8276700: Improve java.lang.ref.Cleaner javadocs

Reviewed-by: rriggs, mchung
This commit is contained in:
Hendrik Schreiber 2022-01-03 15:57:34 +00:00 committed by Roger Riggs
parent 3a1fca3adf
commit c295e71b49

View File

@ -86,9 +86,13 @@ import java.util.function.Function;
* by the Cleaner when the CleaningExample instance has become phantom reachable. * by the Cleaner when the CleaningExample instance has become phantom reachable.
* <pre>{@code * <pre>{@code
* public class CleaningExample implements AutoCloseable { * public class CleaningExample implements AutoCloseable {
* // A cleaner, preferably one shared within a library * // A cleaner (preferably one shared within a library,
* private static final Cleaner cleaner = <cleaner>; // but for the sake of example, a new one is created here)
* private static final Cleaner cleaner = Cleaner.create();
* *
* // State class captures information necessary for cleanup.
* // It must hold no reference to the instance being cleaned
* // and therefore it is a static inner class in this example.
* static class State implements Runnable { * static class State implements Runnable {
* *
* State(...) { * State(...) {