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

    Service Locator Pattern Client-side

    Nick Sahh Newbie

      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
          Darran Lofthouse Master

          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
            jae Master

            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.