1 22 package org.jboss.test.jmx.invoker; 23 24 import java.rmi.RemoteException ; 25 import java.rmi.server.UnicastRemoteObject ; 26 import javax.management.Notification ; 27 import javax.management.NotificationListener ; 28 import org.jboss.jmx.adaptor.rmi.RMINotificationListener; 29 30 34 public class Listener implements NotificationListener 35 { 36 private int expectedCount; 37 private int count; 38 39 public Listener(int expectedCount) 40 { 41 this.expectedCount = expectedCount; 42 } 43 public int getCount() 44 { 45 return count; 46 } 47 public void handleNotification(Notification event, Object handback) 48 { 49 System.out.println("handleNotification, event: "+event+", count="+count); 50 count ++; 51 synchronized( this ) 52 { 53 if( count == expectedCount ) 54 notifyAll(); 55 } 56 } 57 } 58 | Popular Tags |