1 Reply Latest reply on Apr 14, 2008 9:59 PM by 666705

    InitialContext as singleton

      I have concerning InitialContext and number of instances of this class.

      We have an application that uses a singleton InitialContext to obtain references to
      UserTransaction, DataSources of two databases and some ejbs.

      Could the fact that the InitialContext is singleton cause some kind of error, multithreading or performance problem or similar?
      Thanks Jaro
        • 1. Re: InitialContext as singleton
          There should be no issues if you implement it properly.
          Always remember that in Java singletons are singletons per ClassLoader, and whenever you redeploy an app, a new ClassLoader is created. So, if you build an application that is redeploy-friendly, you have to handle the lifecycle of the application and release everything that the singleton has. If you fail to do this, you will end up with some leaks.