Summary

 < Free Open Study > 



We started this chapter by looking at how Java programs, including web applications are built at run time from classes loaded into memory by classloaders. We saw how classloaders look for classes in locations in a predictable order. The order of precedence determines whether separate web applications each see their own versions of those classes, or whether the classes they use are shared. To help in our investigation we created a servlet, ResourceLocatorServlet, that we used to determine the location from which any given class (or any other resource) will be loaded within Tomcat.

We saw how the container's default model for servlets (multi-threading) can be overridden by implementing the SingleThreadModel interface. Although this guarantees that requests to a particular servlet are serialized it can result in some unwanted side effects. Tomcat actually discourages the use of the SingleThreadModel by not supporting servlet pooling. This means that for maximum concurrency, the default multi-threaded model for servlets must be used.

Finally, we saw how multi-threaded servlets can suffer from race conditions that require the developer to explicitly synchronize access to shared resources such as the instance and class variables, and even context and session attributes in order to make the code thread-safe.

In the next chapter we're going to look at the importance of good design within web applications.

A

Accessibility

  • class deployment, 3

application logic

  • effect of class loading, 8

B

banking application

  • deploying, 15

C

CATALINA_HOME directories

  • class deployment organization, 3

class deployment

  • considerations in servlet container, 3

  • JAR or WAR, 3

  • locating classes/resources, 4

  • organization, 3

  • static variables, 10

class loading, 1

  • application logic, effect on, 8

  • finding classes, 2

  • loading/reloading servlets, 11

  • servlet container, 3

  • testing class loading precedence, 6

  • Tomcat 4 precedence, 5

  • Tomcat order of precedence, 7

  • user tracking application, 8

classes

  • HttpServlet class, 5

containers

  • debug trace, 25

context attributes

  • servlets using, 21

  • using servlets with, 24

D

debugging

  • container, within, 25

  • starting debugger, 15

deployment

  • !see also class deployment.

  • banking application, 15

  • user tracking application, 9

doGet() method

  • locating classes, 4

  • multi threaded servlets, 19

  • single threaded servlets, 13

  • synchronization advice, 20

doPost() method

  • synchronization advice, 20

E

explicit synchronization, 20

G

getResource() method

  • class loading, 4

H

HttpServlet class, javax.servlet.http

  • finding location, 5

I

in() method, InOut class

  • single threaded servlets, 13

init() method

  • session and context attributes, 23

interfaces

  • javax.servlet.SingleThreadModel interface, 12

J

JAR (Java application ARchive)

  • class deployment organization, 3

  • or WAR, class deployment, 3

javax.servlet.SingleThreadModel interface

  • banking application, 12

JPDA debugger

  • single threaded servlets, using, 15

L

loading servlets, 11

login() method

  • user tracking application, 8

M

methods

  • doGet() method, 4, 13, 19, 20

  • getResource() method, 4

  • in() method, 13

  • init() method, 23

  • login() method, 8

  • out() method, 13

  • resetValues() method, 12, 22

  • service() method, 12

  • showData() method, 13, 23

  • transfer() method, 13, 20, 22, 28

Microsoft Web Application Stress

  • doPost() method, 20

multi threaded servlets, 18

  • explicit synchronization, 20

  • race condition, 19

  • using, 18

O

out() method

  • single threaded servlets, 13

P

pooling

  • servlets, 17

R

race condition

  • multi threaded servlets, 19

  • testing, 27

reloading servlets, 11

resetValues() method

  • session and context attributes, 22

  • single threaded servlets, 12

reusability

  • class deployment, 3

S

separation

  • class deployment, 3

service() method

  • single threaded servlets, 12

servlet 2.3 specification

  • reloading servlets, 11

servlet container

  • class deployment, 3

  • class loading in, 3

servlets

  • context attributes, using, 21

  • loading, 11

  • multi threaded servlets, 18

  • pooling, 17

  • reloading, 11

  • session attributes, using, 21

  • single threaded servlets, 12

session attributes

  • servlets using, 21

  • using servlets with, 24

showData() method

  • session and context attributes, 23

  • single threaded servlets, 13

single threaded servlets

  • banking application, 12

  • JPDA debugger, 15

  • using, 15

SingleThreadModel interface

  • servlet pooling, 17

static variables

  • class deployment, 10

synchronization, 11

  • explicit synchronization, 20

T

testing

  • race condition, 27

  • user tracking application, 9

threading, 11

Tomcat

  • class loading order of precedence, 7

  • class loading precedence in Tomcat 4, 5

  • servlet pooling, SingleThreadModel, 17

transfer() method

  • explicit synchronization, 20

  • session and context attributes, 22

  • single threaded servlets, 13

  • testing the race condition, 28

U

user tracking application

  • class loading, 8

  • deploying, 9

  • testing, 9

W

WAR (Web Application ARchive)

  • class deployment organization, 3

  • or JAR, class deployment, 3

Web Application Archive see WAR.

web applications

  • class loading, 1

  • multi threaded servlets, 18

  • synchronization, 11

  • threading, 11

WEB_INF directories

  • class deployment organization, 3



 < Free Open Study > 



Professional Java Servlets 2.3
Professional Java Servlets 2.3
ISBN: 186100561X
EAN: 2147483647
Year: 2006
Pages: 130

Similar book on Amazon

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net