-
1. Re: Avoid service to start at startup
rotula Jan 28, 2008 9:42 AM (in response to 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.sarhello-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. -
2. Re: Avoid service to start at startup
brian.stansberry Jan 28, 2008 10:56 AM (in response to rotula)This seems like a bug, at least in the docs. Looking at the code for the ScheduleManager class, the "StartAtStartup" property is not used at all. Actually, looking at the very first checkin of the class I don't see being used.
-
3. Re: Avoid service to start at startup
brian.stansberry Jan 28, 2008 11:24 AM (in response to rotula)Let me look at this a bit more. TBH I haven't looked at this area in quite a while; I suspect there's another way to accomplish what you want.
-
4. Re: Avoid service to start at startup
brian.stansberry Jan 28, 2008 1:25 PM (in response to rotula)OK, I was looking into using the Scheduler class instead of the ScheduleManager (see http://labs.jboss.com/file-access/default/members/jbossas/freezone/docs/Server_Configuration_Guide/beta422/html/Scheduling_Tasks-org.jboss.varia.scheduler.Scheduler_.html for example of Scheduler). But AFAICT it doesn't due anything with the StartAtStartup property either.
Suggest you file a bug report in JIRA. -
5. Re: Avoid service to start at startup
rotula Jan 29, 2008 3:16 AM (in response to rotula)Yes, it's done now, I've create a JIRA report at:
http://jira.jboss.org/jira/browse/JBCLUSTER-189 -
6. Re: Avoid service to start at startup
brian.stansberry Jan 29, 2008 10:46 AM (in response to rotula)Thanks. :) I moved it to the JBAS project as it's really not a clustering issue. See JIRA comment for possible workaround.
-
7. Re: Avoid service to start at startup
rotula Feb 29, 2008 8:22 AM (in response to rotula)Sorry for assignment ;)
OK, I've checked up your proposal workaround and made following changes:
own schedule manager:public class ScheduleManagerExt extends ScheduleManager{ private boolean started = false; @Override public boolean isStarted(){ return started; } @Override public void startSchedules(){ this.started = true; } @Override public void stopSchedules(boolean pDoItNow){ this.started = false; } }
and deployment descriptor (jboss-service.xml):<server> <mbean code="com.demo.mbean..ScheduleManagerExt" name="jboss:service=ScheduleManagerDemo"> <attribute name="StartAtStartup">false</attribute> </mbean> ... </server>
but it doesn't fix the problem in any way.
Any other idea?
Thanks.