public enum JavaGcCleanerWrapper extends Enum<JavaGcCleanerWrapper>
A clean operation can be wrapped with the Java GC Cleaner which will schedule this operation before GC is run for the given owner object (not reachable in user code). but only if the cleaner has not been already run explicitly by user before. If the cleaner is run after GC it will not run clean operation again. This way we guarantee that the clean operation will always run at some point but only once.
The wrapper looks up the underlying Java GC Cleaner class in different packages
Modifier and Type | Method and Description |
---|---|
static Runnable |
createCleaner(Object owner,
Runnable cleanOperation) |
static boolean |
tryRunPendingCleaners() |
static JavaGcCleanerWrapper |
valueOf(String name)
Returns the enum constant of this type with the specified name.
|
static JavaGcCleanerWrapper[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
public static JavaGcCleanerWrapper[] values()
for (JavaGcCleanerWrapper c : JavaGcCleanerWrapper.values()) System.out.println(c);
public static JavaGcCleanerWrapper valueOf(String name)
name
- the name of the enum constant to be returned.IllegalArgumentException
- if this enum type has no constant with the specified nameNullPointerException
- if the argument is nullpublic static boolean tryRunPendingCleaners() throws InterruptedException
InterruptedException
Copyright © 2014–2021 The Apache Software Foundation. All rights reserved.