private static class SharedVariableManager.PersistentShares<T extends SharedVariableManager.PersistentRegistry>
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
private T |
globals
Global pool which is context-local.
|
private SharedVariableManager.PersistentRegistry |
pending
The objects being defined in the currently instantiating external program.
|
private java.util.Map<java.lang.Object,T> |
persistentDictionaries
The persistent dictionaries, saved per each external program.
|
private java.util.IdentityHashMap<java.lang.Object,java.util.concurrent.atomic.AtomicInteger> |
refs
Track references for all shared objects, in all registries (not defined/used) - when
the reference count reaches zero, they will be removed from the transaction-related
registries.
|
Modifier | Constructor and Description |
---|---|
private |
PersistentShares(T globals)
Initialize this container with the specified global registry, which will be used as a
seed for all other scopes.
|
Modifier and Type | Method and Description |
---|---|
T |
getRegistry(ScopeLevel scope,
java.util.function.Supplier<T> newRegistry)
Resolve the registry: if the scope is
ScopeLevel.NEXT , return the globals registry. |
T |
lookupRegistry(java.lang.String name)
Lookup a
SharedVariableManager.PersistentRegistry which contains a shared variable with the given name;
this starts from the top of the stack and searches in the context of each
referent for the given variable name. |
private final java.util.Map<java.lang.Object,T extends SharedVariableManager.PersistentRegistry> persistentDictionaries
private final java.util.IdentityHashMap<java.lang.Object,java.util.concurrent.atomic.AtomicInteger> refs
private SharedVariableManager.PersistentRegistry pending
private final T extends SharedVariableManager.PersistentRegistry globals
private PersistentShares(T globals)
public T getRegistry(ScopeLevel scope, java.util.function.Supplier<T> newRegistry)
ScopeLevel.NEXT
, return the globals
registry.
If the scope is ScopeLevel.NEXT
, return the pending
registry.
Otherwise, return the registry associated with the current ProcedureManager.thisProcedure()
.
public T lookupRegistry(java.lang.String name)
SharedVariableManager.PersistentRegistry
which contains a shared variable with the given name;
this starts from the top of the stack and searches in the context of each
referent
for the given variable name.name
- The shared object name.SharedVariableManager.PersistentRegistry
or null
if it can't be found.