I'm thinking that you are going to run into problems with this technique.
While page instances are thread safe, your page class will definitely be
used by multiple threads. If you are adding to _lista while iterating over
it then you are going to get an ConcurrentModificationException. Performing
actions on this list are going to require considering synchronization
issues.

Of course, this consideration is going to be required of any object that you
store at the application level (in the servlet context for instance) if you
are doing anything other than read only operations.

Josh


On 9/25/07, Marcus <[EMAIL PROTECTED]> wrote:
>
> Hi Robert,
>
> Anyway, if you create a class with static methods and attributes, your
> object will be shared for entire application.
>
> public class ListaEstatica {
>
>        private static List<Usuario> _lista;
>
>        public static List<Usuario> getLista() {
>                if (_lista==null)
>                        _lista=new ArrayList<Usuario>(0);
>                return _lista;
>        }
>
>        public static void add(Usuario usuario) { getLista().add(usuario);
> }
> }
>
>
> Marcus
>



-- 
--
TheDailyTube.com. Sign up and get the best new videos on the internet
delivered fresh to your inbox.

Reply via email to