Java EE 7 SDK 

Samples Main Page

The Threads Concurrency Sample Application

This sample demonstrates how to use javax.enterprise.concurrent.ManagedThreadFactory to obtain a Thread from the Java EE Container.

Description

The sample contains a servlet that uses the newThread() method of the ManagedThreadFactory interface to obtain a Thread from the Java EE Container.

The servlet in this sample uses the default ManagedThreadFactory as defined in the Concurrency Utilities for Java EE 1.0 specification, which is available in all compliant Java EE Products. No special configuration is required.

The following is a list of servlets included in this sample:

URI pattern Description
/TestServlet Obtain a Thread using the newThread() method of the ManagedThreadFactory interface.

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/threads.
  3. Build, deploy, and run the sample application using the run outcome.

    mvn clean verify cargo:run

  4. The front page of this sample is at http://localhost:8080/threads
    (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.