Class 2 |
Intermediate Java 30-IT-397 |
|
interface SingleThreadModel
-
You must take special care to ensure that your doGet() and doPost() methods
are thread safe, because they will be called by a different thread for
each request.
-
But, if you do not want multiple threads to call these methods, simply
implement the SingleThreadModel interface. This tells the server
to allow one thread to complete before beginning the next.
-
But, be careful, this will significantly slow performance.
destroy()
-
Called when the server removes the servlet from operation.
-
A good place to write to a log, close database connections, etc.
-
But don't count on it, the server could always crash!
Using web.xml for packages, initializations

Created by: Brandan Jones
December 20, 2001