Package org.glassfish.api.invocation
Interface InvocationManager
-
- All Known Implementing Classes:
InvocationManagerImpl
@Contract public interface InvocationManager
InvocationManager provides interface to keep track of component context on a per-thread basis
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description List<? extends ComponentInvocation>
getAllInvocations()
<T extends ComponentInvocation>
TgetCurrentInvocation()
Returns the current Invocation object associated with the current thread<T extends ComponentInvocation>
TgetPreviousInvocation()
Returns the previous Invocation object associated with the current thread.boolean
isInvocationStackEmpty()
return true iff no invocations on the stack for this threadApplicationEnvironment
peekAppEnvironment()
Gets the current application environment on the current threadMethod
peekWebServiceMethod()
List<? extends ComponentInvocation>
popAllInvocations()
Useful to temp clear the invocation list for example when spawning a new Thread to prevent potential classloader leaks.void
popAppEnvironment()
To be called by the infrastructure to indicate that some user code not associated with any Java EE specification is finished being called.void
popWebServiceMethod()
<T extends ComponentInvocation>
voidpostInvoke(T inv)
To be called by a Container to indicate that the Container has just completed the invocation of a method on a component.<T extends ComponentInvocation>
voidpreInvoke(T inv)
To be called by a Container to indicate that the Container is about to invoke a method on a component.void
pushAppEnvironment(ApplicationEnvironment env)
To be called by the infrastructure to indicate that some user code not associated with any Java EE specification may be called.void
pushWebServiceMethod(Method method)
void
putAllInvocations(List<? extends ComponentInvocation> invocations)
Useful to temp clear the invocation list for example when spawning a new Thread to prevent potential classloader leaks.void
registerComponentInvocationHandler(ComponentInvocation.ComponentInvocationType type, RegisteredComponentInvocationHandler handler)
default void
setThreadInheritableInvocation(List<? extends ComponentInvocation> parentValue)
Installs the given invocation as thread local in the same way as would be done automatically at thread creation time.
-
-
-
Method Detail
-
preInvoke
<T extends ComponentInvocation> void preInvoke(T inv) throws InvocationException
To be called by a Container to indicate that the Container is about to invoke a method on a component. The preInvoke and postInvoke must be called in pairs and well-nested.- Parameters:
inv
- the Invocation object- Throws:
InvocationException
-
postInvoke
<T extends ComponentInvocation> void postInvoke(T inv) throws InvocationException
To be called by a Container to indicate that the Container has just completed the invocation of a method on a component. The preInvoke and postInvoke must be called in pairs and well-nested.- Parameters:
inv
- the Invocation object- Throws:
InvocationException
-
getCurrentInvocation
<T extends ComponentInvocation> T getCurrentInvocation()
Returns the current Invocation object associated with the current thread
-
getPreviousInvocation
<T extends ComponentInvocation> T getPreviousInvocation() throws InvocationException
Returns the previous Invocation object associated with the current thread. Returns null if there is none. This is typically used when a component A calls another component B within the same VM. In this case, it might be necessary to obtain information related to both component A using getPreviousInvocation() and B using getCurrentInvocation()- Throws:
InvocationException
-
isInvocationStackEmpty
boolean isInvocationStackEmpty()
return true iff no invocations on the stack for this thread
-
getAllInvocations
List<? extends ComponentInvocation> getAllInvocations()
-
setThreadInheritableInvocation
default void setThreadInheritableInvocation(List<? extends ComponentInvocation> parentValue)
Installs the given invocation as thread local in the same way as would be done automatically at thread creation time. This is useful for threads that are re-used between different contexts.- Parameters:
parentValue
- the invocation stack from the parent thread
-
popAllInvocations
List<? extends ComponentInvocation> popAllInvocations()
Useful to temp clear the invocation list for example when spawning a new Thread to prevent potential classloader leaks.
-
putAllInvocations
void putAllInvocations(List<? extends ComponentInvocation> invocations)
Useful to temp clear the invocation list for example when spawning a new Thread to prevent potential classloader leaks.
-
registerComponentInvocationHandler
void registerComponentInvocationHandler(ComponentInvocation.ComponentInvocationType type, RegisteredComponentInvocationHandler handler)
-
pushAppEnvironment
void pushAppEnvironment(ApplicationEnvironment env)
To be called by the infrastructure to indicate that some user code not associated with any Java EE specification may be called. In particular must be called by the Weld integration layer to indicate the application environment in which the portable extensions are runningThe pushAppEnvironment and popAppEnvironment must be called in pairs and well-nested.
- Parameters:
env
- may not be null. Information about the application environment
-
peekAppEnvironment
ApplicationEnvironment peekAppEnvironment()
Gets the current application environment on the current thread- Returns:
- The current ApplicationEnvironment, or null if there is none
-
popAppEnvironment
void popAppEnvironment()
To be called by the infrastructure to indicate that some user code not associated with any Java EE specification is finished being called. In particular must be called by the Weld integration layer to indicate the application environment in which the portable extensions are runningThe pushAppEnvironment and popAppEnvironment must be called in pairs and well-nested.
- Parameters:
env
- may not be null. Information about the application environment
-
pushWebServiceMethod
void pushWebServiceMethod(Method method)
-
peekWebServiceMethod
Method peekWebServiceMethod()
-
popWebServiceMethod
void popWebServiceMethod()
-
-