John Steel wrote:
> 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.

The static instance vs. object instance is "more bad"... it has more of 
a chance to disrupt the classloader reloading, depending on where the 
servlet loads it might be sharing data across webapps... Variables in a 
servlet are just generally a bad design (static or not) and should be 
replaced by something like Spring.

Serge Knystautas
Lokitech >> software . strategy . design >>
p. 301.656.5501

resin-interest mailing list

Reply via email to