|
Actually, I was looking at Java in general, although I have an immediate need of JSP/Servlets. I visualize classes/objects as being sort of variables on steroids; each class that implements other classes has it's own copy of the class/object in the scope of the instantiating class. As a learn more about java, that model breaks down, especially with containers like WAS and Tomcat. Apparently, they all share the code (and can share the instance variables with static). Since local variables are not shared, I can use them without concern. My simple model (above) breaks down really fast in discussions of threads and thread-safe coding. I'm still trying to grasp the concept of sharing code with other requests. If a change an instance variable that is *not* a static, it seems to me (with my meager understanding of Java) that it changes for that particular instantiation of the object. However, the need to make things thread-safe seems to contradict that assumption. My hope is that if I understand this point, I can better comprehend threads which is a huge leap for me (*lots* of procedural language (RPG, COBOL, BASIC, PASCAL, etc.) experience. This multi-threaded stuff reminds me of why I didn't become an electrical engineer). I guess I'm looking for two things. One, why is there a need for thread-safe techniques (the web sites I have read really don't do a good job of telling me why, even Sun's site) and Two, how to best combat this situation in the context of JSP/servlet technology. Clear as mud? dan <snip> I think I made the assumption that Daniel is talking about Servlets, where it makes sense to avoid synchronization and not Swing. <snip>
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.