Please give me an opportunity to redefine my questions more clearly
My question is
 
1. Is it not true that, the singleton service (MyClusterService) will be 
started in the current master node only?
2. Do I need to use if ( isMasterNode() ) check, to avoid the starting the 
Singleton service  in the current slave node?  (My worry is, Is this the right 
way to control the service)
3. Is there any configuration available to control my singleton services from 
getting started only in the current master node 
Am I missing any of them 


MyClusterService.java

  |  public class MyClusterService extends HAServiceMBeanSupport {
  |           private boolean isMasterNode = false;
  |           protected void startService()  throws Exception {
  |               if (isMasterNode()) {
  |                    log.info("MyClusterService Started Successfully");
  |                    //Send JMS messages to indicate Service Started
  |              }else {
  |                    log.info("MyClusterService - Waiting to acquire Master 
Status");
  |              }
  |          }
  |           protected void stopService() {
  |              log.info("Stopping MyClusterService - If Slave is waiting it 
will become master ");
  |          }
  |          public boolean isMasterNode() {
  |               return isMasterNode;
  |          }
  |          public void startSingleton() {
  |              isMasterNode = true;
  |             if (isMasterNode) {
  |                startService();
  |            }
  |         }
  |          public void stopSingleton() {
  |               stopService();
  |              isMasterNode=false;
  |          } 
  |     }
  | 
jboss-service.xml

  |  <mbean code="org.jboss.ha.singleton.HASingletonController"
  |           name="my.com:service=MyService-HASingletonController">
  |       
  | <depends>jboss:service=${jboss.partition.name:DefaultPartition}</depends>  
  |       <depends>my.com:service=MyClusterService</depends>
  |       <attribute 
  | name="PartitionName">${jboss.partition.name:DefaultPartition}</attribute>
  |       <attribute 
  | name="TargetName">my.com:service=MyClusterService</attribute>
  |       <attribute name="TargetStartMethod">startSingleton</attribute>
  |       <attribute name="TargetStopMethod">stopSingleton</attribute>
  |       <!-- <attribute name="TargetStopMethodArgument">true</attribute> -->
  |    </mbean>
  |    <mbean code="com.my.cluster.MyClusterService"
  |         name="my.com:service=MyClusterService">
  |         <depends>my.com:service=OtherServices</depends>
  |     </mbean>        
  | 

Thanks
Krithi





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

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

Reply via email to