1 Reply Latest reply on Jan 28, 2008 9:40 AM by rotula

    Avoid service to start at startup

    rotula

      This is actually a copy of same question in another forum http://www.jboss.com/index.html?module=bb&op=viewtopic&t=128231

      I am running a clustered instance of jboss 4.2.1 GA and deploying a service app.
      MyClusterService - which extends ServiceMBeanSupport - is triggered via the scheduler to run periodically.
      Here is the jboss-service.xml:

      <server>
       <mbean code="org.jboss.varia.scheduler.ScheduleManager"
       name="jboss:service=ScheduleManagerJSFDemo">
       <attribute name="StartAtStartup">false</attribute>
       </mbean>
      
       <mbean code="com.jsfdemo.mbean.MyClusterService"
       name="com.jsfdemo:service=MyClusterService">
       </mbean>
      
       <mbean code="org.jboss.varia.scheduler.SingleScheduleProvider"
       name="jboss:service=HAImportScheduleProviderJSFDemo">
      
       <depends>jboss:service=ScheduleManagerJSFDemo</depends>
       <depends>com.jsfdemo:service=ImportManager</depends>
      
       <attribute name="ScheduleManagerName">jboss:service=ScheduleManagerJSFDemo</attribute>
       <attribute name="TargetName">com.jsfdemo:service=MyClusterService</attribute>
       <attribute name="TargetMethod">perform( DATE, REPETITIONS )</attribute>
       <attribute name="DateFormat" />
       <attribute name="StartDate">NOW</attribute>
       <attribute name="Period">10000</attribute>
       <attribute name="Repetitions">-1</attribute>
       </mbean>
      </server>
      

      According documentation, if attribute "StartAtStartup" of ScheduleManager is set to false, the service should not trigger,
      which happends today regardless the state of the attribute.

      Is this anyway to avoid the service to start at startup in this case and how?

      thank you.

        • 1. Re: Avoid service to start at startup
          rotula

          OK! I've create a very simple test project similar to ExampleHelloWorldService:

          The Management Interface:

          package com.demo;
          
          public interface HelloWorldServiceMBean extends ServiceMBean{
           public void perform(Date now, long remainingRepetitions);
          }
          


          The Service Implementation:
          package com.demo.mbean;
          
          public class HelloWorldService extends ServiceMBeanSupport implements HelloWorldServiceMBean{
          
           public void perform( Date now, long remainingRepetitions ){
           log.info( "[perform]: " + now.toString() );
           }
          }
          


          The deployment descriptor (jboss-service.xml):
          <server>
           <mbean code="org.jboss.varia.scheduler.ScheduleManager"
           name="jboss:service=ScheduleManagerDemo"><attribute name="StartAtStartup">false</attribute>
           </mbean>
          
           <mbean code="com.demo.mbean.HelloWorldService"
           name="com.demo:service=HelloWorldService">
           </mbean>
          
           <mbean code="org.jboss.varia.scheduler.SingleScheduleProvider"
           name="jboss:service=HAImportScheduleProviderDemo">
          
           <depends>jboss:service=ScheduleManagerDemo</depends>
           <depends>com.demo:service=HelloWorldService</depends>
          
           <attribute name="ScheduleManagerName">jboss:service=ScheduleManagerDemo</attribute>
           <attribute name="TargetName">com.demo:service=HelloWorldService</attribute>
           <attribute name="TargetMethod">perform( DATE, REPETITIONS )</attribute>
           <attribute name="DateFormat" />
           <attribute name="StartDate">NOW</attribute>
           <attribute name="Period">2000</attribute>
           <attribute name="Repetitions">-1</attribute>
           </mbean>
          </server>
          


          And everything deployed in a sar file with the following structure:

          hello-world.sar
          hello-world.sar/META-INF/jboss-service.xml
          hello-world.sar/com/demo/HelloWorldService.class
          hello-world.sar/com/demo/HelloWorldServiceMBean.class
          


          Despite the element StartAtStartup of ScheduleManager is set to false, the service trigger anyway.

          Is this a bug or did I missing?

          thanks.