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 org.jboss.jmx.adaptor.rmi.RMINotificationListener; 28 import org.jboss.net.sockets.TimeoutClientSocketFactory; 29 30 38 public class RMIBadListener implements RMINotificationListener 39 { 40 int count; 41 42 public int getCount() 43 { 44 return count; 45 } 46 public void export() throws RemoteException 47 { 48 TimeoutClientSocketFactory tcsf = new TimeoutClientSocketFactory(); 49 UnicastRemoteObject.exportObject(this, 0, tcsf, null); 50 } 51 public void unexport() throws RemoteException 52 { 53 UnicastRemoteObject.unexportObject(this, true); 54 } 55 public void handleNotification(Notification event, Object handback) 56 { 57 System.out.println("BadListener handleNotification, event: "+event+", count="+count); 58 count ++; 59 try 60 { 61 System.out.println("Sleeping 30 seconds..."); 62 Thread.sleep(30*1000); 63 } 64 catch(InterruptedException e) 65 { 66 e.printStackTrace(); 67 } 68 System.out.println("Awake"); 69 } 70 } 71 | Popular Tags |