HotSpotObjectConstant
.
A HotSpotObjectConstant
allocated in a local scope will have
its reference to any foreign object cleared when the scope closes. This
allows the foreign memory manager to reclaim the foreign object (once there are no other strong
references to it).
HotSpotObjectConstantScope
s have no impact on HotSpotObjectConstant
s that do not
encapsulate a foreign object reference.
The object returned by enterGlobalScope()
or openLocalScope(Object)
should
always be used in a try-with-resources statement. Failure to close a scope will almost certainly
result in foreign objects being leaked.
Modifier and Type | Field and Description |
---|---|
pack-priv static final ThreadLocal | |
private List | |
pack-priv final Object | localScopeDescription
An object whose |
private final HotSpotObjectConstantScope |
Access | Constructor and Description |
---|---|
private |
Modifier and Type | Method and Description |
---|---|
pack-priv void | |
public void | close()
Implements java. Closes this resource, relinquishing any underlying resources. |
public static HotSpotObjectConstantScope | Returns: null if the current runtime does not support remote object references or if
this thread is currently in the global scopeEnters the global scope. |
pack-priv boolean | |
public static HotSpotObjectConstantScope | Returns: null if the current runtime does not support remote object referencesan non-null object whose description)Object#toString() value describes the
scope being openedOpens a local scope that upon closing, will release foreign object references encapsulated by
|
CURRENT | back to summary |
---|---|
pack-priv static final ThreadLocal<HotSpotObjectConstantScope> CURRENT |
foreignObjects | back to summary |
---|---|
private List<IndirectHotSpotObjectConstantImpl> foreignObjects |
localScopeDescription | back to summary |
---|---|
pack-priv final Object localScopeDescription An object whose |
parent | back to summary |
---|---|
private final HotSpotObjectConstantScope parent |
HotSpotObjectConstantScope | back to summary |
---|---|
private HotSpotObjectConstantScope(Object localScopeDescription) |
add | back to summary |
---|---|
pack-priv void add(IndirectHotSpotObjectConstantImpl obj) |
close | back to summary |
---|---|
public void close() Implements java. Doc from java. Closes this resource, relinquishing any underlying resources.
This method is invoked automatically on objects managed by the
|
enterGlobalScope | back to summary |
---|---|
public static HotSpotObjectConstantScope enterGlobalScope() Enters the global scope. This is useful to escape a local scope for execution that will
create foreign object references that need to outlive the local scope.
Foreign object references encapsulated by
|
isGlobal | back to summary |
---|---|
pack-priv boolean isGlobal() Determines if this scope is global. |
openLocalScope | back to summary |
---|---|
public static HotSpotObjectConstantScope openLocalScope(Object description) Opens a local scope that upon closing, will release foreign object references encapsulated by
|