Java EE 7 SDK |
This sample demonstrates how to use javax.enterprise.concurrent.ManagedScheduledExecutorService
for submitting delayed or periodic tasks.
The sample contains a collection of servlets showing the usage of the methods in the ManagedScheduledExecutorService
interface to submit delayed or periodic tasks to be processed asynchronously.
All the sample servlets in this demo use the
default ManagedScheduledExecutorService
as defined in the Concurrency Utilities for Java EE 1.0 specification which is
available in all compliant Java EE Products. Thus no special configuration is required.
The following is a list of servlets included in this demo:
URI pattern | Description |
---|---|
/TestScheduledServlet | Submit delayed tasks using the schedule() method of ManagedScheduledExecutorService . |
/TestScheduleFixedRateServlet | Submit fixed-rate tasks using the scheduleAtFixedRate() method of ManagedScheduledExecutorService . |
/TestScheduleWithFixedDelayServlet | Submit fixed-delay tasks using the scheduleWithFixedDelay() method of ManagedScheduledExecutorService . |
/TestTriggerServlet | Submit custom periodic tasks with a Trigger . |
The application is built and deployed as a WAR file.
schedule()
, scheduleWithFixedDelay()
, scheduleAtFixedRate()
methods of ManagedScheduledExecutorService
javax.enterprise.concurrent.Trigger
interfacePerform the following steps to build, deploy, and run the application:
samples_install_dir
is the sample application base directory. Go to: samples_install_dir/javaee7/concurrency/schedule
.
run
outcome.
mvn clean verify cargo:run
http://localhost:8080/schedule
clean
outcome to undeploy the sample application and to remove the temporary directories such as
build
and dist
.
mvn clean
If you have problems when running the application, refer to the troubleshooting document.
Copyright © 1997-2013 Oracle and/or its affiliates. All rights reserved.