I have NO instance variables in HttpServlet classes, and all calls to helpers are either local instance variables, or static calls for data that is displayed on
JSP pages.
Example:
class ShoppingCart extends HttpServlet {
public void execute() {
int selectedBook = request.getAttribute("bookId");
Delegate delegate = new Delegate();
Book book = delegate.getBookDetail(selectedBook);
ArrayList authors = delegate.getAuthorDetails(selectedBook);
request.setAttribute("bookDetail", book);
request.setAttribute("authorDetail", authors);
// show book detail or forward to jsp page...
}
}
I have not seen any need to make any code ThreadSafe in this case.
1) Is there any situation that will fail the application?
2) How much are Threads used in High transaction Web based applications? (Extensive/Minimal/As needed?)
Please share your expertise,
- Avi