1 22 package org.jboss.test.jmx.compliance.server.support; 23 24 import javax.management.Notification ; 25 import javax.management.NotificationListener ; 26 27 34 public class MBeanListener 35 implements NotificationListener , MBeanListenerMBean 36 { 37 public long count = 0; 38 public Object source = null; 39 public Object handback = null; 40 public long count1 = 0; 41 public Object source1 = new Object (); 42 public Object handback1 = new Object (); 43 public long count2 = 0; 44 public Object source2 = new Object (); 45 public Object handback2 = new Object (); 46 47 Object hb1 = null; 48 Object hb2 = null; 49 50 public MBeanListener() 51 { 52 } 53 54 public MBeanListener(String hb1, String hb2) 55 { 56 this.hb1 = hb1; 57 this.hb2 = hb2; 58 } 59 60 public void handleNotification(Notification n, Object nhb) 61 { 62 if (nhb != null && nhb.equals(hb1)) 63 { 64 count1++; 65 source1 = n.getSource(); 66 handback1 = nhb; 67 } 68 else if (nhb != null && nhb.equals(hb2)) 69 { 70 count2++; 71 source2 = n.getSource(); 72 handback2 = nhb; 73 } 74 else 75 { 76 count++; 77 source = n.getSource(); 78 handback = nhb; 79 } 80 } 81 } 82 | Popular Tags |