1 Reply Latest reply on Jul 31, 2003 2:49 AM by manavagiwal

    Singleton and JBoss / J2EE

    sharon_benaim

      Hi, I am in a process of integrating jBoss into an existing server architecture mainly for it's messaging capabilities, JMS, and MDB between simple clients, and other jBoss server in a multi tier environment. Part of the old design is base on singleton objects that are constantly active, and cache a lot of data in the memory. What is the best way to implementing Singleton mechanism, or to keep objects/ EJB's on the memory. Any information will be very helpful Thanks, Sharon.

        • 1. Re: Singleton and JBoss / J2EE
          manavagiwal

          J2EE specs discourages people to use static modifier and synchronised keyword for methods which are vital for implementing the singleton pattern. Encouraging this has an impact on Bean pooling and caching. It doesnot mean that it is wrong to implement singleton with EJBs Pattern. It should just be done right.

          JBoss comes with classes that help you implement singleton pattern. You can deploy an MBean which has a single instance running in the whoke cluster. Take a look at this article.

          http://www.cocoonhive.org/articles/jboss/20030610/hasingleton.html

          Hope that helps.
          Manav