Controlling Concurrent Access to Shared Resources
Controlling Concurrent Access to Shared Resources
TABLE 43
Scope Objects
Scope Object
Class
Accessible From
Web context
Web components within a web context. See
Session
Web components handling a request that belongs to the
session. See
Request
subtype of
Web components handling the request.
Page
The JSP page that creates the object. See
shows the scoped attributes maintained by the Duke's Bookstore application.
Controlling Concurrent Access to Shared Resources
In a multithreaded server, it is possible for shared resources to be accessed concurrently. In
addition to scope object attributes, shared resources include in-memory data (such as instance
or class variables) and external objects such as files, database connections, and network
connections.
Concurrent access can arise in several situations:
Multiple web components accessing objects stored in the web context.
Multiple web components accessing objects stored in a session.
currency
Session
Attribute
cart
Session
Attribute
BookStoreServlet
BookDetailsServlet
CatalogServlet
ShowCartServlet
CashierServlet
ReceiptServlet
hitCounterFilter
OrderFilter
hitCounter
bookDB
orderCounter
Web
Context
Attribute
FIGURE 41
Duke's Bookstore Scoped Attributes
Sharing Information
The Java EE 5 Tutorial · September 2007
106