Java Reference
In-Depth Information
package org.javaee7.chapter11;
import java.util.Properties;
import javax.annotation.Resource;
import javax.batch.operations.JobOperator;
import javax.batch.runtime.BatchRuntime;
import javax.ejb.Schedule;
import javax.ejb.Stateless;
import javax.ejb.TimerService;
@Stateless
public class BatchTimer {
@Resource
TimerService timerService;
@Schedule(minute="*", hour="*")
public void scheduledTimerExample(){
System.out.println("Initiating the batch job...");
JobOperator job = BatchRuntime.getJobOperator();
job.start("acmeFileProcessor", new Properties());
}
}
As mentioned in the introduction to this chapter, the Batch Applications for Java EE API is very detailed, and this
example barely scratches the surface of how to write batch jobs. You are encouraged to learn more about the API by
reading through the specification for JSR-352.
Summary
The Java Enterprise platform has been missing some commonly required APIs until the latest release of Java EE 7.
Until the EE 7 release, there had not been a standard way to develop multi-threaded applications that are deployed in
an application server environment. Moreover, there has never been a standard way to perform and/or schedule batch
applications. The EE 7 release brings forth a handful of new APIs for enterprise development, and among those are
the Concurrency Utilities for Java EE and Batch Applications.
This chapter reviewed some of the basic concepts for both the Concurrency and Batch APIs for Java EE. You learned
how to configure application server resources that are used with these technologies, and also learned how to utilize the
new APIs to integrate these techonlogies into your applications. Going forward, Java Enterprise developers can begin to
utilize these new standards for developing applications that necessitate concurrency and/or batch solutions.
 
Search WWH ::




Custom Search