Browse Prior Art Database

Delegated Thread Creation in a J2EE Web Application

IP.com Disclosure Number: IPCOM000028996D
Original Publication Date: 2004-Jun-10
Included in the Prior Art Database: 2004-Jun-10
Document File: 3 page(s) / 45K

Publishing Venue

IBM

Abstract

This disclosure descries a technique for delegating thread creation to avoid the inherent problems in J2EE with creating threads directly. This is done by creating a Runnable object that is not started until a new servlet request arrives. The purpose of the new servlet request is to start the execution of the Runnable after the user interface has been updated.

This text was extracted from a PDF file.
At least one non-text object (such as an image or picture) has been suppressed.
This is the abbreviated version, containing approximately 53% of the total text.

Page 1 of 3

Delegated Thread Creation in a J 2EE Web Application

Problem Statement

Java Threads are an extremely valuable tool for J2EE Web applications because they provide the framework needed for multi-tasking. Progress inidication, for example, is an important feature that would not be possible without Threads. This is because one Thread is needed to perform the work while another Thread monitors the work and displays feedback to the user. However, the current J2EE web technology imposes a significant barrier to multi-tasking because it does not provide a way to create Threads that can outlive the span of an HTTP request/response cycle. Here is an excerpt from the Java
2.4 Servlet Specification that describes the limitation :

Implementations of the request and response objects are not guaranteed to be thread safe. This means that they should only be used within the scope of the request handling thread. References to the request and response objects should not be given to objects executing in other threads as the resulting behavior may be nondeterministic. If the thread created by the application uses the container-managed objects, such as the request or response object, those objects must be accessed only within the servlet's service life cycle and such thread itself should have a life cycle within the life cycle of the servlet's service method because accessing those objects after the service method ends may cause undeterministic problems.

Java 2.4 Servlet Specification http://jcp.org/aboutJava/communityprocess/final/jsr154/index.html

Figure 1 below shows a graphical depiction of the Threading limitation.

1

Page 2 of 3

While this limitation does not specifically prohibit the creation of Threads in...