Package org.glassfish.api.invocation
Class InvocationManagerImpl
- java.lang.Object
-
- org.glassfish.api.invocation.InvocationManagerImpl
-
- All Implemented Interfaces:
InvocationManager
@Service @Singleton public class InvocationManagerImpl extends Object implements InvocationManager
-
-
Constructor Summary
Constructors Constructor Description InvocationManagerImpl()
InvocationManagerImpl(ComponentInvocationHandler... handlers)
-
Method Summary
All Methods Instance Methods Concrete 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 invocation)
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 invocation)
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)
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.
-
-
-
Constructor Detail
-
InvocationManagerImpl
public InvocationManagerImpl()
-
InvocationManagerImpl
public InvocationManagerImpl(ComponentInvocationHandler... handlers)
-
-
Method Detail
-
setThreadInheritableInvocation
public void setThreadInheritableInvocation(List<? extends ComponentInvocation> parentValue)
Description copied from interface:InvocationManager
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.- Specified by:
setThreadInheritableInvocation
in interfaceInvocationManager
- Parameters:
parentValue
- the invocation stack from the parent thread
-
preInvoke
public <T extends ComponentInvocation> void preInvoke(T invocation) throws InvocationException
Description copied from interface:InvocationManager
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.- Specified by:
preInvoke
in interfaceInvocationManager
- Parameters:
invocation
- the Invocation object- Throws:
InvocationException
-
postInvoke
public <T extends ComponentInvocation> void postInvoke(T invocation) throws InvocationException
Description copied from interface:InvocationManager
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.- Specified by:
postInvoke
in interfaceInvocationManager
- Parameters:
invocation
- the Invocation object- Throws:
InvocationException
-
isInvocationStackEmpty
public boolean isInvocationStackEmpty()
Description copied from interface:InvocationManager
return true iff no invocations on the stack for this thread- Specified by:
isInvocationStackEmpty
in interfaceInvocationManager
- Returns:
- true iff no invocations on the stack for this thread
-
getCurrentInvocation
public <T extends ComponentInvocation> T getCurrentInvocation()
Description copied from interface:InvocationManager
Returns the current Invocation object associated with the current thread- Specified by:
getCurrentInvocation
in interfaceInvocationManager
- Returns:
- the Invocation object of the component being called
-
getPreviousInvocation
public <T extends ComponentInvocation> T getPreviousInvocation() throws InvocationException
Description copied from interface:InvocationManager
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()- Specified by:
getPreviousInvocation
in interfaceInvocationManager
- Returns:
- the Invocation object of the caller or null if none exist (e.g. caller is from another VM)
- Throws:
InvocationException
-
getAllInvocations
public List<? extends ComponentInvocation> getAllInvocations()
- Specified by:
getAllInvocations
in interfaceInvocationManager
-
popAllInvocations
public List<? extends ComponentInvocation> popAllInvocations()
Description copied from interface:InvocationManager
Useful to temp clear the invocation list for example when spawning a new Thread to prevent potential classloader leaks.- Specified by:
popAllInvocations
in interfaceInvocationManager
-
putAllInvocations
public void putAllInvocations(List<? extends ComponentInvocation> invocations)
Description copied from interface:InvocationManager
Useful to temp clear the invocation list for example when spawning a new Thread to prevent potential classloader leaks.- Specified by:
putAllInvocations
in interfaceInvocationManager
-
registerComponentInvocationHandler
public void registerComponentInvocationHandler(ComponentInvocation.ComponentInvocationType type, RegisteredComponentInvocationHandler handler)
- Specified by:
registerComponentInvocationHandler
in interfaceInvocationManager
-
pushAppEnvironment
public void pushAppEnvironment(ApplicationEnvironment env)
Description copied from interface:InvocationManager
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.
- Specified by:
pushAppEnvironment
in interfaceInvocationManager
- Parameters:
env
- may not be null. Information about the application environment
-
peekAppEnvironment
public ApplicationEnvironment peekAppEnvironment()
Description copied from interface:InvocationManager
Gets the current application environment on the current thread- Specified by:
peekAppEnvironment
in interfaceInvocationManager
- Returns:
- The current ApplicationEnvironment, or null if there is none
-
popAppEnvironment
public void popAppEnvironment()
Description copied from interface:InvocationManager
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.
- Specified by:
popAppEnvironment
in interfaceInvocationManager
-
pushWebServiceMethod
public void pushWebServiceMethod(Method method)
- Specified by:
pushWebServiceMethod
in interfaceInvocationManager
-
peekWebServiceMethod
public Method peekWebServiceMethod()
- Specified by:
peekWebServiceMethod
in interfaceInvocationManager
-
popWebServiceMethod
public void popWebServiceMethod()
- Specified by:
popWebServiceMethod
in interfaceInvocationManager
-
-