| com.sun.xml.ws.api.pipe.FiberContextSwitchInterceptor
FiberContextSwitchInterceptor | public interface FiberContextSwitchInterceptor (Code) | | Interception for
Fiber context switch.
Even though pipeline runs asynchronously, sometimes it's desirable
to bind some state to the current thread running a fiber. Such state
may include security subject (in terms of
AccessController.doPrivileged ),
or a transaction.
This mechanism makes it possible to do such things, by allowing
some code to be executed before and after a thread executes a fiber.
The design also encapsulates the entire fiber execution in a single
opaque method invocation
Work.execute , allowing the use of
finally block.
author: Kohsuke Kawaguchi |
Inner Class :interface Work | |
Method Summary | |
R | execute(Fiber f, P p, Work<R, P> work) Allows the interception of the fiber execution.
This method needs to be implemented like this:
<R,P> R execute( Fiber f, P p, Work<R,P> work ) {
// do some preparation work
...
try {
// invoke
return work.execute(p);
} finally {
// do some clean up work
...
}
}
While somewhat unintuitive,
this interception mechanism enables the interceptor to wrap
the whole fiber execution into a
AccessController.doPrivileged(PrivilegedAction) ,
for example.
Parameters: f - Fiber to be executed. Parameters: p - The opaque parameter value for Work. |
execute | R execute(Fiber f, P p, Work<R, P> work)(Code) | | Allows the interception of the fiber execution.
This method needs to be implemented like this:
<R,P> R execute( Fiber f, P p, Work<R,P> work ) {
// do some preparation work
...
try {
// invoke
return work.execute(p);
} finally {
// do some clean up work
...
}
}
While somewhat unintuitive,
this interception mechanism enables the interceptor to wrap
the whole fiber execution into a
AccessController.doPrivileged(PrivilegedAction) ,
for example.
Parameters: f - Fiber to be executed. Parameters: p - The opaque parameter value for Work. Simply pass this value toWork.execute(Object).The opaque return value from the the Work. Simply returnthe value from Work.execute(Object). |
|
|