Java Reference
In-Depth Information
DefaultManagedScheduledExecutorService")
ManagedExecutorService taskExecutor;
@GET
@Path("getListOfAllStudentsAs2")
public void getListOfAllStudentsAs2(final
@Suspended AsyncResponse response) {
System.out.println("before time : "+new
Date());
taskExecutor.submit(
new Runnable() {
public void run() {
String queryString = "SELECT s FROM
Student sWHERE 1 = 1";
TypedQuery<Student> query =
em.createQuery(queryString, Student.class);
List<Student> studentList =
query.getResultList();
try {
Thread.sleep(10 * 1000);//1 second
} catch (Exception ex) {
}
response.resume(studentList);
}
});
System.out.println("After time : "+new
Date());
}
}
Filters and entity interceptors
Another big ticket of the JAX-RS 2.0 Specification is the introduction of two mechan-
isms for interception: filters and interceptors. These new features bring to the spe-
cification a standard way to intercept processing in order to seamlessly manage se-
curity, compression, encoding, logging, editing, and auditing of exchanges between
a JAX-RS server and the different clients that will access the server resources.
Search WWH ::




Custom Search