public class MyServlet extends HttpServlet { private int nonThreadSafeInt = 1; public void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException { nonThreadSafeInt++; try { Thread.currentThread().sleep((long) Math.random() * 5000); nonThreadSafeInt++; } catch (Exception e) { } nonThreadSafeInt++; .. } }
I understand nonThreadSafeInt isn't thread safe. This means it must be shared across all instances. So whats the difference between that and declaring it as public static int nonThreadSafeInt = 1; apart from then being able to do MyServlet.nonThreadSafeInt++; which I can't see a use for. Thanks -- John -------------------------- http://www.phonewebcam.com [EMAIL PROTECTED] _______________________________________________ resin-interest mailing list resin-interest@caucho.com http://maillist.caucho.com/mailman/listinfo/resin-interest