public class NoAllocationVerifier extends Object implements AutoCloseable
Modifier | Constructor and Description |
---|---|
protected |
NoAllocationVerifier(String reason) |
Modifier and Type | Method and Description |
---|---|
void |
close() |
static void |
exit(String callSite,
String typeName)
A guard to place before an allocation, giving the call site and the allocation type.
|
static NoAllocationVerifier |
factory(String reason)
Create an opened instance.
|
static NoAllocationVerifier |
factory(String reason,
boolean open)
Create an instance that can be opened lazily.
|
static boolean |
isActive()
Returns true if there is an open NoAllocationVerifier, i.e., returns true if no allocation is
allowed in this thread.
|
NoAllocationVerifier |
open() |
public static final String ERROR_MSG
protected NoAllocationVerifier(String reason)
public static void exit(String callSite, String typeName)
public static NoAllocationVerifier factory(String reason)
try (NoAllocationVerifier verifier = NoAllocationVerifier.factory()) { .... }
public static NoAllocationVerifier factory(String reason, boolean open)
NoAllocationVerifier instance = NoAllocationVerifier.factory(false); .... try(NoAllocationVerifier resource = instance.open()) { .... }
public static boolean isActive()
public NoAllocationVerifier open()
public void close()
close
in interface AutoCloseable