Java Reference
In-Depth Information
your threads in the context of a Java EE component, you will just need
to combine ManagedThreadFactory , ExecutorService , and Contex-
tService objects. The result is as shown in the following code:
public class ReportCustomizedThread
implements Runnable {
public void run() {
//Report processing ...
}
}
@Resource(name=»concurrent/
ReportManagedThreadGenerator»)
ManagedThreadFactory threadFactory;
@Resource(name=»concurrent/
ReportContextServiceGenerator»)
ContextService contextService;
ReportCustomizedThread reportThread = new
ReportCustomizedThread();
Runnable proxy
=contextService.createContextualProxy(reportThread,Runnable.class);
ExecutorService executorService
=Executors.newFixedThreadPool(20,
threadFactory);
Future result =
executorService.submit(proxy);
//...
This is probably a simple example of the use you can make of this feature. For more
advanced examples, please consult the specification document in the Context ser-
vice section.
The following diagram provides an overview of relationships between Concurrency
Utilities and other Java EE platform elements:
Search WWH ::




Custom Search