A
Distributed Container
is one capable of distributing Web components that are tagged as
distributable
across different multiple Java Virtual Machines, perhaps running in different
hosts. A
Distributable Application
is one tagged as such in its Web deployment descriptor. A
Distributable JSP Page
is one in a Distributable Application.
By default, there must be only one instance of a JSP page implementation class per JSP page
definition in a container (Section 3.2 of Servlet 2.2 spec). By default, an instance of a Web
Application must only be run on one Java Virtual Machine at any one time. This behavior
can be overridden by declaring the Application to be Distributable (Chapter 9 of Servlet 2.2.
specification).
A
single threaded JSP page
is one with a
false
value for its
isThreadSafe
attribute of a
page
directive. If
isThreadSafe= false
, the JSP page implementation shall implement
javax.servlet.SingleThreadModel
, thus indicating that all requests dispatched to
that instance shall be delivered serially to the
service()
method of the page implementation
class (Section 3.3.3.1 of Servlet 2.2 spec).
However, some implementation(s) may additionally use a pool consisting of multiple page
implementation class instances to do load balancing. Therefore, even when indicating that
the page is not thread safe, a page author cannot assume that all requests mapped to a
particular JSP page shall be delivered to the same instance of that page's implementation
class. The consequence of this is that an author must assume that any mutable resources not
private/unique to a particular page's instance may be accessed/updated simultaneously by 2
or more instances; thus any static field values, objects with
session
or
application
scope, or objects shared through some other (unspecified) mechanism by such instances must
be accessed appropriately synchronized to avoid non deterministic behaviors (Section 3.2.1
of Servlet 2.2 spec).
In the case of a Distributable JSP page, there is one instance of its JSP page implementation
class per web component definition per Java Virtual Machine in a Distributed Container
(Section 3.2 of Servlet 2.2 spec).
If multiple web component definitions in the deployment descriptor indicate the same JSP
page, there will be multiple instances of the JSP page implementation class, with different
initialization parameters (Section 3.3.1 of Servlet 2.2 spec).
There is only one instance of the
ServletContext
interface associated with each Web
Application deployed into a Web Container. In cases where the container is distributed over
many Java Virtual Machines, there is one instance per web application per Java Virtual
Machine (Section 4.1 of Servlet 2.2 spec).
Context Attributes exist locally to the Java Virtual Machine in which they were created and
placed. This prevents the ServletContext from being used as a distributed shared memory
store. If information needs to be shared between servlets running in a distributed
environment, that information should be placed in a session, a database, or in an Enterprise
JavaBean (Section 4.3.1 of Servlet 2.2 spec).
Chapter 2
Standard Syntax and Semantics
48
JSP Web Hosting JavaServer Pages Specifications JSP Hosting
|
|
|
|
TotalRoute.net Business web hosting division of Vision Web Hosting Inc. All rights reserved. |