1 22 23 package org.jboss.test.ha.jmx; 24 25 import java.util.Stack ; 26 27 import javax.management.MalformedObjectNameException ; 28 import javax.management.Notification ; 29 import javax.management.ObjectName ; 30 31 import org.jboss.ha.jmx.HAServiceMBeanSupport; 32 33 38 public class HAServiceMBeanSupportTester extends HAServiceMBeanSupport 39 { 40 41 public Stack __invokationStack__ = new Stack (); 42 43 public boolean __isDRMMasterReplica__ = false; 44 45 public boolean __isSingletonStarted__ = false; 46 47 public boolean __shouldSendNotificationRemoteFail__ = false; 48 49 protected void setupPartition() throws Exception 50 { 51 __invokationStack__.push("setupPartition"); 52 } 53 54 protected void registerRPCHandler() 55 { 56 __invokationStack__.push("registerRPCHandler"); 57 } 58 59 protected void unregisterRPCHandler() 60 { 61 __invokationStack__.push("unregisterRPCHandler"); 62 } 63 64 protected void registerDRMListener() throws Exception 65 { 66 __invokationStack__.push("registerDRMListener"); 67 } 68 69 protected void unregisterDRMListener() throws Exception 70 { 71 __invokationStack__.push("unregisterDRMListener"); 72 } 73 74 protected boolean isDRMMasterReplica() 75 { 76 __invokationStack__.push("isDRMMasterReplica"); 77 return __isDRMMasterReplica__; 78 } 79 80 public void callMethodOnPartition(String methodName, Object [] args) 81 throws Exception 82 { 83 __invokationStack__.push("callMethodOnCluster:" + methodName); 84 } 85 86 protected void sendNotificationRemote(Notification notification) 87 throws Exception 88 { 89 if (__shouldSendNotificationRemoteFail__) 90 throw new Exception ("simulated exception"); 91 __invokationStack__.push("sendNotificationRemote"); 92 __invokationStack__.push(notification); 93 } 94 95 protected void sendNotificationToLocalListeners(Notification notification) 96 { 97 __invokationStack__.push("sendNotificationToLocalListeners"); 98 __invokationStack__.push(notification); 99 } 100 101 public ObjectName getServiceName() 102 { 103 ObjectName oname = null; 104 try 105 { 106 oname = new ObjectName ("jboss.examples:name=HAServiceMBeanSupportTester"); 107 } 108 catch (MalformedObjectNameException e) 109 { 110 e.printStackTrace(); 112 } 113 return oname; 114 } 115 116 } 117 | Popular Tags |