2 Replies Latest reply on Oct 13, 2010 8:00 AM by nimo stephan

    Singleton totally mulitread-capable ?

    nimo stephan Master

      When I use a Singleton, do I have to bother with multithreaded issues or does the container care of all that issues?

       

      For example:

       

      When using a Map in a Singleton. Should I delcare it this way:

       

      private Map<AtomicInteger, Users> users = new ConcurrentHashMap<AtomicInteger, Users>();

       

      or can I use this:

       

      private Map<Integer, Users> users = new HashMap<Integer, Users>();