3 Replies Latest reply on Nov 17, 2007 5:30 PM by alrubinger

    How to create singletons?

    aidndev

      We need to create singleton classes to cache database data. Using an EJB container we are not guaranteed that truly one object is being instantiated and shared. I have heard various answers to this, including some mysterious "well, it depends on the classloader..." answers. From what I have found online, the answer appears to have something to do with declaring the class final, or using @service, but I don't know if these are definitely the solution. How can we make a singleton that is definitely really a singleton?