3 Replies Latest reply on Apr 12, 2012 10:28 AM by robvarga

    invocation service not start automatically

    925966
      hi, I have configured invocation service to start automatically as below, however, it did not work. And I need to code in application to get the service by CacheFactory.getService("MyInvocationService") to start it... why this is so? thanks.

      Henry

                <invocation-scheme>
                     <scheme-name>example-invocation</scheme-name>
                     <service-name>MyInvocationService</service-name>
                     <thread-count>10</thread-count>
                     <autostart system-property="tangosol.coherence.invocation.autostart">true</autostart>
                </invocation-scheme>
        • 1. Re: invocation service not start automatically
          robvarga
          922963 wrote:
          hi, I have configured invocation service to start automatically as below, however, it did not work. And I need to code in application to get the service by CacheFactory.getService("MyInvocationService") to start it... why this is so? thanks.

          Henry

                    <invocation-scheme>
                         <scheme-name>example-invocation</scheme-name>
                         <service-name>MyInvocationService</service-name>
                         <thread-count>10</thread-count>
                         <autostart system-property="tangosol.coherence.invocation.autostart">true</autostart>
                    </invocation-scheme>
          Hi,

          the autostart property provides information to the DefaultCacheServer.startServices() method and to methods it calls. That method will start the service if it is marked to be autostarted. The DefaultCacheServer class (the standalone cache server node script starts this application) is the only class which out-of-the-box calls that method (or possibly there are a few other ones like MBeanConnector).

          But if you use your own main class then it is not automatically called, it is your responsibility to call that method (or DefaultCacheServer.start()) if you want the services to autostart. Read the javadoc of the DefaultCacheServer class for more info on methods in that class and variations between them (e.g. monitoring thread, which configurable cache factory is used, etc).

          Best regards,

          Robert
          • 2. Re: invocation service not start automatically
            925966
            Hi Robert,

            thanks. Yes, I have my own Main class. In order to leverage the start and monitor etc already provided by DefaultCacheServer, should my Main class extend DefaultCacheServer? or any better way to do this?

            Henry
            • 3. Re: invocation service not start automatically
              robvarga
              922963 wrote:
              Hi Robert,

              thanks. Yes, I have my own Main class. In order to leverage the start and monitor etc already provided by DefaultCacheServer, should my Main class extend DefaultCacheServer? or any better way to do this?

              Henry
              Hi Henry,

              just call DefaultCacheServer.start() which will start the services (but won't start the monitoring thread which restarts the Coherence services if the node was kicked out of the cluster, automatically).

              If you want the monitoring thread, too, then, I believe, you can call DefaultCacheServer.startDaemon().

              Stopping the services and the monitoring thread is with DefaultCacheServer.shutdown().

              Best regards,

              Robert