Java Reference
In-Depth Information
Chapter 11
Concurrency and Batch Applications
The Java Enterprise platform has been missing a few key features since its inception. Those features include standard
techniques for processing tasks concurrently, and standardization for batch application processing. In the release
of Java EE 7, these two missing features have been addressed with the addition of the Java Concurrency Utilities and
Batch Processing APIs.
The scope of these additional APIs is very large, and this chapter will not attempt to cover each feature. However, the
examples contained within this chapter should provide enough information to get a developer up and running using
some of the most frequently required pieces of each API. For more in-depth information regarding the details of the
Concurrency Utilities for Java EE, please refer to the JavaDoc located at http://concurrency-ee-spec.java.net/javadoc/ .
The Batch Applications for the Java Platform API are immense, with a plethora of options available. This chapter will
barely scratch the surface of the API; for more information, please refer to the specification at
https://java.net/projects/jbatch/pages/Home .
Concurrency
Using Java SE concurrency utilities such as java.util.concurrent and java.lang.Thread in Java EE applications has
been problematic in the past, since the application server container has no knowledge of such resources. Extensions
of the java.util.concurrent API allows application servers and other EE containers to become aware of these
concurrency resources. The extensions allow enterprise applications to appropriately utilize asynchronous operations
via the use of java.util.concurrent.ExecutorService resources that are made available within the EE environment.
Understanding the Contextual Objects and Tasks
The Concurrency Utilities for Java EE API makes use of the following different types of managed objects:
ManagedExecutorService
ManagedScheduledExecutorService
ContextService
ManagedThreadFactory
In this section of the chapter, you will learn how to make use of these managed objects from within an application
server container, such as GlassFish v4. You will then learn about using each of these managed objects to provide
concurrency to your applications, and you will see examples of each.
 
 
Search WWH ::




Custom Search