Let's say we have a Class Util with a static method meth such as:
Class Util { public static String meth (String s) { StringBuffer sb = new StringBuffer(); sb.append (s); sb.append (s); return sb.toString(); } } Let's say I have two JSPs from completely different context roots, but running on the same system. One calls <% Util.meth ("aa"); %>, the other calls <% Util.meth ("bb"); %> Of course with my luck, they get called by two different users (different sessions too right?) at as close to exactly the same time. So, is it possible one invocation could get interrupted by another? How can it not without it being synchronized? Is there only one "copy" of Util being used by multiple JSPs? If so, does the local variable sb have the same address for both invocations? If yes, then I assume I could get invocation 1 interrupted with sb == to say "aa", then invocation 2 could start, repoint sb to a new StringBuffer, execute up to the return, then invocation 1 resumes with sb now == to "bbbb"; invocation1 finishes up the 2nd append and returns with "bbbbaa." Is this scenario possible? I'm having difficulty with understanding the system interaction of JSPs and beans with static methods. That is, unless the above is true, in which case I guess I'm not having difficulty understanding. Obviously, judicious use of synchronization could completely avert this situation if it is indeed true, but I am just wondering if such is needed. Note that the above silly example is just for explanation purposes. Thanks much. =========================================================================== To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST". For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST". Some relevant archives, FAQs and Forums on JSPs can be found at: http://java.sun.com/products/jsp http://archives.java.sun.com/jsp-interest.html http://forums.java.sun.com http://www.jspinsider.com