2 Replies Latest reply on May 10, 2004 1:28 PM by jae77

    Service Locator Pattern Client-side

    nickshah

      Doesn't really stop you doing it for caching but singletons on the server side should not be relied on as the application server may run multiple JVMs or use multiple classloaders that would result in multiple instances of the singleton.

        • 1. Re: Service Locator Pattern Client-side
          darranl

          Doesn't really stop you doing it for caching but singletons on the server side should not be relied on as the application server may run multiple JVMs or use multiple classloaders that would result in multiple instances of the singleton.

          • 2. Re: Service Locator Pattern Client-side
            jae77

            we're currently doing this in our application. (server side singleton).

            provided that you are building an instance of the class using a static initializer, you shouldn't have any issues. (this also assumes that your interfaces are packaged seperately and won't be cycled on a hot-deploy).

            we originally had problems b/c instead of using the static initializer, only created the instance if the instance variable was null. switching to the static initializer solved that problem and i have yet to encounter any other ill-effects.