private static class ProcedureManager.WorkArea extends java.lang.Object implements Initializable, Scopeable
| Modifier and Type | Field and Description |
|---|---|
private java.util.ArrayDeque<ProcedureManager.CalleeInfoImpl> |
calleeInfo
A stack containing the info about the next called program or internal entry.
|
private java.util.ArrayDeque<java.util.List<java.lang.Runnable>[]> |
cleanupHandlers
Stack with output parameter handlers to be processed on procedure's return.
|
private java.util.Map<java.lang.String,java.util.Set<java.lang.String>> |
defaultDbs
The default databases for each java package prefix.
|
private java.util.IdentityHashMap<java.lang.Object,java.lang.Boolean> |
deleteOnExit
Map with flags indicating if this procedure should be deleted on exit.
|
private static java.util.LinkedList<java.lang.Runnable>[] |
EMPTY_SCOPE_STACK
An immutable marker for UNUSED stack of cleanup handlers for a scope.
|
private ErrorManager.ErrorHelper |
errHelper
Helper to use the
ErrorManager without any context local lookups. |
private handle.Helper |
h
Helper to use the
handle without any context local lookups. |
private java.lang.String |
initiatingExtProg
The 4GL program name being currently initiating.
|
private java.lang.Class<?> |
initiatingExtProgClass
The Java class for the current external program or OE class being executed.
|
private java.util.ArrayDeque<java.lang.String> |
internalEntryStack
Stack of internal entry names.
|
private ObjectOps.ObjectHelper |
oh
Helper to use the
ObjectOps without any context local lookups. |
private WrappedResource |
pendingResourceDelete
The resource currently being deleted.
|
private java.util.LinkedHashSet<WrappedResource> |
pendingResources
Resources pending to registered with THIS-PROCEDURE when the next block is entered.
|
private FastSiblingDeque<java.lang.Object> |
persistentProcedures
The list of all registered persistent procedures, via RUN PERSISTENT calls.
|
private java.util.IdentityHashMap<java.lang.Object,Stack<BlockDefinition>> |
persistentProcStacks
This will store the a snapshot of the block stack when the first global buffer was
used.
|
private java.util.IdentityHashMap<java.lang.Object,ProcedureManager.ProcedureData> |
pMap
This map holds the attributes for all registered external procedures, by instance.
|
private java.lang.Object |
processedProcedure
Indicates the current external program when a scope or finalizable notification occurs.
|
private java.lang.Object |
publishSourceProcedure
Explicit referent used as SOURCE-PROCEDURE for a PUBLISH statement.
|
private boolean |
registerPendingResources
Flag indicating if static resources can be added to
pendingResources. |
private java.util.IdentityHashMap<java.lang.Object,java.lang.String> |
relativeNames
Map of relative names (i.e.
|
private java.util.Set<java.lang.Object> |
remotePersistentProcedures
A registry of persistent procedures which were instantiated by a remote side.
|
private java.util.LinkedHashMap<java.lang.Object,ProcedureManager.ProcedureData> |
sessionSuperProcs
A map containing the list of super-procedures, for the session, by each instance.
|
private java.util.IdentityHashMap<java.lang.Class<?>,java.lang.Object> |
singletonMap
This map holds all the singleton instances in this context.
|
private java.util.ArrayDeque<ProcedureManager.ProcedureData> |
sourceProceduresData
Stack of source-procedures' data.
|
java.util.Set<java.lang.Object> |
staleProcedures
A set of persistent procedures which were deleted but are in a state that allow them to be deleted again
|
private java.util.LinkedList<ProcedureManager.Subscription> |
subscriptions
The global list of subscriptions, for this context.
|
private java.util.HashMap<character,java.util.LinkedList<ProcedureManager.Subscription>> |
subscriptionsByEvent
Per-event subscribes, to avoid iterating all subscriptions when performing a PUBLISH.
|
private java.util.ArrayDeque<ProcedureManager.ProcedureData> |
targetProceduresData
Stack of target-procedures' data.
|
private java.util.ArrayDeque<ProcedureManager.ProcedureData> |
thisProceduresData
Stack of this-procedures' data.
|
private TransactionManager.TransactionHelper |
tm
Helper to use the TM without any context local lookups.
|
private WidgetPool.WidgetPoolHelper |
wp
Helper to use the
WidgetPool without any context local lookups. |
| Modifier | Constructor and Description |
|---|---|
private |
WorkArea() |
| Modifier and Type | Method and Description |
|---|---|
void |
addPersistentProcStack(java.lang.Object referent,
Stack<BlockDefinition> stack)
Adds a block stack snapshot to the persistent procedure stacks.
|
boolean |
addStaleReferent(java.lang.Object referent)
Marks the specified referent as stale.
|
void |
cleanup(java.lang.Object referent)
Attempt cleanup of the given external program instance.
|
private java.util.Iterator<java.lang.Object> |
destinationIterator()
Get an iterator over the stack of destination resolved code.
|
private java.util.Iterator<java.lang.Class<?>> |
executingIterator()
Get an iterator over the stack of currently executing code.
|
void |
forceCleanup(java.lang.Object referent)
Cleanup of the given external program instance.
|
private java.lang.Class<?> |
getExecuting()
Get the Java class associated with the currently executing code.
|
Stack<BlockDefinition> |
getPersistentProcStack(java.lang.Object referent)
Obtains the stack snapshot of one persistent procedure.
|
ScopeId |
getScopeId()
Get the
ScopeId for the instance. |
java.util.Map<java.lang.Object,ProcedureManager.ProcedureData> |
getSessionSuperProcedures()
Get the map of session's super-procedures.
|
java.lang.String |
getStackEntry(int idx)
Implementation for the PROGRAM-NAME functions.
|
java.util.Map<java.lang.Object,ProcedureManager.ProcedureData> |
getSuperProcedures(java.lang.Object referent,
boolean readOnly)
Get the map of the super-procedures for the given referent.
|
boolean |
hasPersistentProcStack(java.lang.Object referent)
Check if a referent is persistent and has a stack attached.
|
void |
init()
Initialize this instance - read the
default-databases configuration. |
boolean |
isRemotePersistentProcedure(java.lang.Object referent)
Check if an external program was ran persistent by a remote side.
|
void |
removeStaleProcedure(java.lang.Object referent)
Removes the referent information from the persistent procedure stack mapping.
|
void |
scopeDeleted()
Provides a notification that an external scope is about to be deleted.
|
void |
scopeFinished()
Handle scope notifications, to maintain proper source, target, and
this-procedure references.
|
void |
scopeStart(BlockDefinition block)
Handle scope notifications, to maintain proper source, target, and
this-procedure references.
|
java.lang.Object |
searchInStack(java.util.function.Function<java.lang.Object,java.lang.Object> search)
Walk the
THIS-PROCEDURE stack and apply the search function;
return the first value given by the search function, once it returns a non-null value. |
void |
setInstantingExternalProgram(java.lang.String name)
Set the name of the 4GL program currently being instantiated, into the
initiatingExtProg field. |
void |
setInstantingExternalProgramClass(java.lang.Class<?> cls)
Set the Java class of the currently instantiating external program or OE class.
|
private boolean |
superProcForExtProc(java.lang.Object referent,
java.util.Collection<java.lang.Object> progs)
Check if the given referent is a super-procedure of one of the
procedures in the given list.
|
private java.util.Map<java.lang.String,java.util.Set<java.lang.String>> defaultDbs
private TransactionManager.TransactionHelper tm
private WidgetPool.WidgetPoolHelper wp
WidgetPool without any context local lookups.private ErrorManager.ErrorHelper errHelper
ErrorManager without any context local lookups.private handle.Helper h
handle without any context local lookups.private ObjectOps.ObjectHelper oh
ObjectOps without any context local lookups.private FastSiblingDeque<java.lang.Object> persistentProcedures
private java.util.LinkedHashMap<java.lang.Object,ProcedureManager.ProcedureData> sessionSuperProcs
private java.util.IdentityHashMap<java.lang.Class<?>,java.lang.Object> singletonMap
private java.util.IdentityHashMap<java.lang.Object,ProcedureManager.ProcedureData> pMap
private java.util.ArrayDeque<ProcedureManager.ProcedureData> targetProceduresData
private java.util.ArrayDeque<ProcedureManager.ProcedureData> sourceProceduresData
private java.util.ArrayDeque<ProcedureManager.ProcedureData> thisProceduresData
private final java.util.ArrayDeque<java.util.List<java.lang.Runnable>[]> cleanupHandlers
EMPTY_SCOPE_STACK immutable object to avoid memory consumption due unused new
objects. This will be replaced with a true stack at the moment of first usage. We use a deque/stack
to enforce the order of execution of the cleanup handlers to be in reverse order, the LIFO order
assuring the scope bracketing inside nested scopes.private static final java.util.LinkedList<java.lang.Runnable>[] EMPTY_SCOPE_STACK
private java.lang.Object publishSourceProcedure
private java.util.ArrayDeque<java.lang.String> internalEntryStack
#thisProcedures stack.private java.util.LinkedHashSet<WrappedResource> pendingResources
private boolean registerPendingResources
pendingResources.private java.util.IdentityHashMap<java.lang.Object,java.lang.String> relativeNames
private java.lang.Object processedProcedure
private WrappedResource pendingResourceDelete
private java.util.ArrayDeque<ProcedureManager.CalleeInfoImpl> calleeInfo
private java.lang.String initiatingExtProg
private java.lang.Class<?> initiatingExtProgClass
private java.util.IdentityHashMap<java.lang.Object,java.lang.Boolean> deleteOnExit
private java.util.Set<java.lang.Object> remotePersistentProcedures
private java.util.LinkedList<ProcedureManager.Subscription> subscriptions
private java.util.HashMap<character,java.util.LinkedList<ProcedureManager.Subscription>> subscriptionsByEvent
private java.util.IdentityHashMap<java.lang.Object,Stack<BlockDefinition>> persistentProcStacks
public java.util.Set<java.lang.Object> staleProcedures
public void init()
default-databases configuration.init in interface Initializablepublic void addPersistentProcStack(java.lang.Object referent,
Stack<BlockDefinition> stack)
referent - The persistent procedure to which the stack is mapped.stack - The stack which should represent the current block stack snapshot.public boolean hasPersistentProcStack(java.lang.Object referent)
referent - The persistent procedure for which the checking is done.true if the referent has a persistent procedure stack attached.public Stack<BlockDefinition> getPersistentProcStack(java.lang.Object referent)
referent - The persistent procedure for which the stack should be retrieved.public boolean addStaleReferent(java.lang.Object referent)
referent - The referent which should be marked as stale.true if the provided referent was made stale for the first time.public void removeStaleProcedure(java.lang.Object referent)
referent - The persistent procedure for which the entry should be removed.public java.lang.Object searchInStack(java.util.function.Function<java.lang.Object,java.lang.Object> search)
THIS-PROCEDURE stack and apply the search function;
return the first value given by the search function, once it returns a non-null value.search - The search function.public void setInstantingExternalProgram(java.lang.String name)
initiatingExtProg field.name - The 4GL external program name.public void setInstantingExternalProgramClass(java.lang.Class<?> cls)
cls - The Java class for the currently executing code.public boolean isRemotePersistentProcedure(java.lang.Object referent)
referent - The external program instance.true if the referent is part of the
remotePersistentProcedures map.public java.lang.String getStackEntry(int idx)
idx - The stack entry index.null if outside of stack.public void scopeStart(BlockDefinition block)
scopeStart in interface Scopeableblock - The explicit block definition which required this notification.public void scopeFinished()
scopeFinished in interface Scopeablepublic void scopeDeleted()
This implementation is a no-op.
scopeDeleted in interface Scopeablepublic ScopeId getScopeId()
ScopeId for the instance.getScopeId in interface Scopeablenull, as the scope notification is done explicitly via
TransactionManager.public java.util.Map<java.lang.Object,ProcedureManager.ProcedureData> getSessionSuperProcedures()
public java.util.Map<java.lang.Object,ProcedureManager.ProcedureData> getSuperProcedures(java.lang.Object referent, boolean readOnly)
referent - The external program instance for which the super-procedures
are needed.readOnly - Flag indicating that the result will not be altered.public void cleanup(java.lang.Object referent)
pMap
map.referent - The external program instance for which needs to be cleaned
up.public void forceCleanup(java.lang.Object referent)
pMap map.referent - The external program instance for which needs to be cleaned
up.private java.lang.Class<?> getExecuting()
private java.util.Iterator<java.lang.Class<?>> executingIterator()
private java.util.Iterator<java.lang.Object> destinationIterator()
private boolean superProcForExtProc(java.lang.Object referent,
java.util.Collection<java.lang.Object> progs)
referent - The external program instance.progs - The list of external programs for which their
super-procedures list will be searched for the referent.true if it was found as a super-procedure for
one of the given procedures.