Sorry for slow response on this.

You've subclassed HAServiceMBeanSupport to implement MyClusterService. Do you 
need to do this in order for MyClusterService to do what it is supposed to? If 
not. don't subclass that class.

Do you need to subclass ServiceMBeanSupport (which is a superclass of 
HAServiceMBeanSupport) in order for MyClusterService to do what it is supposed 
to? If not, consider not subclassing that class either.

Next, decide what lifecycle steps you want MyClusterService to go through.

If you implement any of the methods named create() start() stop() destroy() 
then JBoss is going to invoke those methods when it deploys MyClusterService.  
This is not regulated by whether you are the master or not. (This is why you 
shouldn't subclass ServiceMBeanSupport if you don't need to and don't want to 
expose create/start/stop/destroy).

If you do implement create/start/stop/destroy, then your service really has a 6 
step lifecycle:

create  -- done at deployment time
start    -- done at deployment time
startSingleton -- when becomes master
stopSingleton -- when stops being master
stop -- done at undeployment time
destroy -- done at undeployment time

I very much advise against trying to subclass HAServiceMBeanSupport and then 
overriding startService to check if you are the master.  Mixing together the 
start and startSingleton lifecycle steps is just asking for trouble. If your 
service needs to do some startup work when it becomes the master and not 
before, implement it directly in startSingleton, not in startService.

View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4100396#4100396

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4100396
_______________________________________________
jboss-user mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/jboss-user

Reply via email to