test/java/rmi/activation/rmidViaInheritedChannel/RmidViaInheritedChannel.java

Print this page




  73         Callback obj = null;
  74 
  75         try {
  76             /*
  77              * Export callback object and bind in registry.
  78              */
  79             System.err.println("export callback object and bind in registry");
  80             obj = new RmidViaInheritedChannel();
  81             Callback proxy = (Callback)
  82                 UnicastRemoteObject.exportObject(obj, 0);
  83             Registry registry =
  84                 LocateRegistry.createRegistry(
  85                     TestLibrary.RMIDVIAINHERITEDCHANNEL_REGISTRY_PORT);
  86             registry.bind("Callback", proxy);
  87 
  88             /*
  89              * Start rmid.
  90              */
  91             System.err.println("start rmid with inherited channel");
  92             RMID.removeLog();
  93             rmid = RMID.createRMID(System.out, System.err, true, false,
  94                                    TestLibrary.RMIDVIAINHERITEDCHANNEL_ACTIVATION_PORT);
  95             rmid.addOptions(
  96                 "--add-exports=java.base/sun.nio.ch=ALL-UNNAMED",
  97                 "-Djava.nio.channels.spi.SelectorProvider=RmidViaInheritedChannel$RmidSelectorProvider");
  98             if (System.getProperty("os.name").startsWith("Windows") &&
  99                 System.getProperty("os.version").startsWith("5."))
 100             {
 101                 /* Windows XP/2003 or older
 102                  * Need to expand ephemeral range to include RMI test ports
 103                  */
 104                 rmid.addOptions(new String[]{
 105                     "-Djdk.net.ephemeralPortRange.low=1024",
 106                     "-Djdk.net.ephemeralPortRange.high=64000"
 107                 });
 108             }
 109             rmid.start();
 110 
 111             /*
 112              * Get activation system and wait to be notified via callback
 113              * from rmid's selector provider.




  73         Callback obj = null;
  74 
  75         try {
  76             /*
  77              * Export callback object and bind in registry.
  78              */
  79             System.err.println("export callback object and bind in registry");
  80             obj = new RmidViaInheritedChannel();
  81             Callback proxy = (Callback)
  82                 UnicastRemoteObject.exportObject(obj, 0);
  83             Registry registry =
  84                 LocateRegistry.createRegistry(
  85                     TestLibrary.RMIDVIAINHERITEDCHANNEL_REGISTRY_PORT);
  86             registry.bind("Callback", proxy);
  87 
  88             /*
  89              * Start rmid.
  90              */
  91             System.err.println("start rmid with inherited channel");
  92             RMID.removeLog();
  93             rmid = RMID.createRMIDOnEphemeralPort(System.out, System.err, true, false,
  94                                    TestLibrary.RMIDVIAINHERITEDCHANNEL_ACTIVATION_PORT);
  95             rmid.addOptions(
  96                 "--add-exports=java.base/sun.nio.ch=ALL-UNNAMED",
  97                 "-Djava.nio.channels.spi.SelectorProvider=RmidViaInheritedChannel$RmidSelectorProvider");
  98             if (System.getProperty("os.name").startsWith("Windows") &&
  99                 System.getProperty("os.version").startsWith("5."))
 100             {
 101                 /* Windows XP/2003 or older
 102                  * Need to expand ephemeral range to include RMI test ports
 103                  */
 104                 rmid.addOptions(new String[]{
 105                     "-Djdk.net.ephemeralPortRange.low=1024",
 106                     "-Djdk.net.ephemeralPortRange.high=64000"
 107                 });
 108             }
 109             rmid.start();
 110 
 111             /*
 112              * Get activation system and wait to be notified via callback
 113              * from rmid's selector provider.