Java Reference
In-Depth Information
Tip
Downloading the example code
You can download the example code files for all Packt topics you
have purchased from your account at http://www.packtpub.com .
If you purchased this topic elsewhere, you can visit ht-
tp://www.packtpub.com/support and register to have the files e-
mailed directly to you.
• After declaring the JNDI reference, you can then inject it by using the
@Resource annotation as shown in the following code:
@Resource(name="concurrent/
ReportGenerator")
ManagedExecutorService
reportGenerator;
• The task to submit to the container must either implement the
java.lang.Runnable or java.util.concurrent.Callable
interface. The differences between these interfaces are presented in
the following table:
Runnable
Callable
Since JDK 1.0.
Since JDK 5.0.
It has run() method to
define task.
It has the call() method to define
task.
Search WWH ::




Custom Search