File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes Instance variables and multi-threading Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "Instance variables and multi-threading" Watch "Instance variables and multi-threading" New topic

Instance variables and multi-threading

Paulus Maessen

Joined: Sep 29, 2004
Posts: 12
Hi all,

I have a question about the example in the SCWCD exam study kit:

On page 165, listing 10.7 shows a servlet that uses an instance variable to cache a database connection. As I understand it this is not threadsafe.

Chengwei Lee
Ranch Hand

Joined: Apr 02, 2004
Posts: 884
Yep, instance variables are *never* threadsafe.

SCJP 1.4 * SCWCD 1.4 * SCBCD 1.3 * SCJA 1.0 * TOGAF 8
I agree. Here's the link:
subject: Instance variables and multi-threading
It's not a secret anymore!