IBM WebSphere Adapters User Manual page 196

Version 6 release 2
Table of Contents

Advertisement

FFDC processing overview
Instead of explicitly instrumenting catch blocks by calling FFDC directly, either
manually or by using a tool, you can write a simple aspect using the AspectJ
language, which encapsulates the FFDC policy for your code.
The FFDCSupport aspect is abstract. Like an abstract class, FFDCSupport cannot be
instantiated and defers some of its implementation to a sub-aspect. It follows the
standard library aspect pattern of declaring an abstract pointcut for which you
must declare a concrete implementation. This concrete implementation of the
pointcut can use the simple AspectJ scoping pointcut designators (PCD) such as
within() and withincode() to determine the packages, classes and methods to be
included in the FFDC policy.
FFDC programming examples
The following examples assume a certain familiarity with the AspectJ language
(see http://eclipse.org/aspectj/). In most cases a user of the FFDCSupport aspect
will require knowledge of only a small subset of the AspectJ syntax. In particular
they should know how to define a concrete aspect by extending an abstract one
and how to declare a concrete pointcut typically using simple scoping primitive
pointcuts.
import com.ibm.websphere.ffdc.FFDCSupport;
public aspect Example_1 extends FFDCSupport {
protected pointcut ffdcScope () :
within(com.foo.*);
}
Figure 7. Add FFDC to the com.foo package
Figure 1 illustrates the simple aspect Example_1 that adds FFDC to all classes in
the com.foo package. The example illustrates the following processing:
1. On line 1, the FFDCSupport aspect is imported
2. On line 3, the FFDCSupport aspect is extended and made concrete in a similar
3. On line 5, the inherited abstract pointcut ffdcScope()\ is made concrete.
import com.ibm.websphere.ffdc.FFDCSupport;
public aspect Example_2 extends FFDCSupport {
protected pointcut ffdcScope () :
within(com.foo..*);
}
Figure 2 illustrates aspect Example_2, which differs from Example_1 . Notice line 13, where the wildcard includes
"double dots" (..) in the within() PCD, which means the includes all classes in the com.foo package and sub-packages.
For example, com.foo.impl.Bar.
Figure 8. Add FFDC to com.foo package and all sub-packages
190
WebSphere Adapters: WebSphere Adapter Toolkit User Guide
way to a Java class.
This is done using the within() pointcut designator (PCD) and "*" wildcard
that results in FFDC for all classes in the com.foo package. For example,
com.foo.Bar.

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

Websphere adapter toolkit

Table of Contents