Java EE 7 SDK 

Samples Main Page

The Schedule Concurrency Sample Application

This sample demonstrates how to use javax.enterprise.concurrent.ManagedScheduledExecutorService for submitting delayed or periodic tasks.

Description

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.

Key Features

Building, Deploying, and Running the Application

Perform the following steps to build, deploy, and run the application:

  1. Set up your build environment and configure the application server with which the build system has to work by following the common build instructions.
  2. samples_install_dir is the sample application base directory. Go to: samples_install_dir/javaee7/concurrency/schedule.
  3. Build, deploy, and run the sample application using the run outcome.

    mvn clean verify cargo:run

  4. Front page of this sample is at http://localhost:8080/schedule
    (the port number might vary).
  5. Use the clean outcome to undeploy the sample application and to remove the temporary directories such as build and dist.

    mvn clean

Troubleshooting

If you have problems when running the application, refer to the troubleshooting document.


 

Copyright © 1997-2013 Oracle and/or its affiliates. All rights reserved.