A reusable and extensible interceptor framework. This package contains a reusable and extensible interceptor framework. This is very useful to provide a very
flexible mechanism to insert simplistic business logic into all invocations on one or more target objects.
The InterceptorStack represents a chain or stack of {@link Interceptor interceptors} that are invoked
to perform an action or operation. The various {@link Interceptor interceptors} each are given the
opportunity to do something interesting before delegating to the next {@link Interceptor interceptor}
in the stack. Generally the last {@link Interceptor interceptor} in the chain invokes the requested
operation, and returns the result back through the stack (in the reverse order).
Again, each {@link Interceptor interceptor} can do something interesting before returning the
results back to their caller.
Here are a few examples of "something interesting" an {@link Interceptor interceptor} may do:
- Interpretting and performing the action (this is typically the last interceptor)
- Log the action before it is performed
- Log the action after it is performed
- Accumulate statistics of various actions
- Log (or even terminate) actions that are considered long-lived (e.g., take longer than a
pre-determined amount of time)
- Ensure the target object is ready for the action to be performed (e.g., if the target is a
{@link java.lang.ref.Reference Reference} ensure the proxy's delegate is available)
- Perform security checks
- Annotate the action with additional information
- Convert the action into an alternative form
Of course, there are many more.
Related Documentation