test/java/rmi/server/UnicastRemoteObject/keepAliveDuringCall/ShutdownImpl.java

Print this page




  51 
  52             Thread.sleep(500);
  53             System.err.println("(ShutDownImpl.shutdown) FEE");
  54             Thread.sleep(500);
  55             System.err.println("(ShutDownImpl.shutdown) FIE");
  56             Thread.sleep(500);
  57             System.err.println("(ShutDownImpl.shutdown) FOE");
  58             Thread.sleep(500);
  59             System.err.println("(ShutDownImpl.shutdown) FOO");
  60 
  61             monitor.declareStillAlive();
  62             System.err.println("(ShutDownImpl.shutdown) still alive!");
  63         } catch (Exception e) {
  64             throw new RuntimeException(
  65                 "unexpected exception occurred in shutdown method", e);
  66         }
  67     }
  68 
  69     public static void main(String[] args) {
  70         try {

  71             Registry registry =
  72                 LocateRegistry.getRegistry("", TestLibrary.REGISTRY_PORT);
  73             ShutdownMonitor monitor = (ShutdownMonitor)
  74                 registry.lookup(KeepAliveDuringCall.BINDING);
  75             System.err.println("(ShutdownImpl) retrieved shutdown monitor");
  76 
  77             impl = new ShutdownImpl(monitor);
  78             Shutdown stub = (Shutdown) UnicastRemoteObject.exportObject(impl);
  79             System.err.println("(ShutdownImpl) exported shutdown object");
  80 
  81             monitor.submitShutdown(stub);
  82             System.err.println("(ShutdownImpl) submitted shutdown object");
  83 
  84         } catch (Exception e) {
  85             System.err.println("(ShutdownImpl) TEST SUBPROCESS FAILURE:");
  86             e.printStackTrace();
  87         }
  88     }
  89 }


  51 
  52             Thread.sleep(500);
  53             System.err.println("(ShutDownImpl.shutdown) FEE");
  54             Thread.sleep(500);
  55             System.err.println("(ShutDownImpl.shutdown) FIE");
  56             Thread.sleep(500);
  57             System.err.println("(ShutDownImpl.shutdown) FOE");
  58             Thread.sleep(500);
  59             System.err.println("(ShutDownImpl.shutdown) FOO");
  60 
  61             monitor.declareStillAlive();
  62             System.err.println("(ShutDownImpl.shutdown) still alive!");
  63         } catch (Exception e) {
  64             throw new RuntimeException(
  65                 "unexpected exception occurred in shutdown method", e);
  66         }
  67     }
  68 
  69     public static void main(String[] args) {
  70         try {
  71             int registryPort = new Integer(System.getProperty("rmi.registry.port"));
  72             Registry registry =
  73                 LocateRegistry.getRegistry("", registryPort);
  74             ShutdownMonitor monitor = (ShutdownMonitor)
  75                 registry.lookup(KeepAliveDuringCall.BINDING);
  76             System.err.println("(ShutdownImpl) retrieved shutdown monitor");
  77 
  78             impl = new ShutdownImpl(monitor);
  79             Shutdown stub = (Shutdown) UnicastRemoteObject.exportObject(impl);
  80             System.err.println("(ShutdownImpl) exported shutdown object");
  81 
  82             monitor.submitShutdown(stub);
  83             System.err.println("(ShutdownImpl) submitted shutdown object");
  84 
  85         } catch (Exception e) {
  86             System.err.println("(ShutdownImpl) TEST SUBPROCESS FAILURE:");
  87             e.printStackTrace();
  88         }
  89     }
  90 }