< prev index next >

test/java/rmi/registry/altSecurityManager/AltSecurityManager.java

Print this page




  41  * that throws a runtime exception in its checkListen method, this
  42  * will cause rmiregistry and rmid to exit early because those
  43  * utilities will be unable to export any remote objects; test fails
  44  * if registry and rmid take too long to exit.
  45  */
  46 public class AltSecurityManager implements Runnable {
  47     private final int regPort;
  48     // variable to hold registry and rmid children
  49     static JavaVM vm = null;
  50 
  51     // names of utilities
  52     static String utilityToStart = null;
  53     static final String REGISTRY_IMPL = "sun.rmi.registry.RegistryImpl";
  54     static final String ACTIVATION = "sun.rmi.server.Activation";
  55 
  56     // children should exit in at least this time.
  57     static long TIME_OUT = 15000;
  58 
  59     public AltSecurityManager(int port) {
  60         if (port <= 0) {
  61             TestLibrary.bomb("Port must be greater then 0.");
  62         }
  63 
  64         this.regPort = port;
  65     }
  66 
  67     public void run() {
  68         try {
  69             if (utilityToStart.equals(REGISTRY_IMPL)) {
  70                 vm = new JavaVM(utilityToStart,
  71                         " -Djava.security.manager=TestSecurityManager",
  72                         Integer.toString(regPort));
  73             } else if (utilityToStart.contains(ACTIVATION)) {
  74                 vm = new JavaVM(utilityToStart,
  75                         " -Djava.security.manager=TestSecurityManager",
  76                         "-port " + Integer.toString(regPort));
  77             } else {
  78                 TestLibrary.bomb("Utility to start must be " + REGISTRY_IMPL +
  79                         " or " + ACTIVATION);
  80             }
  81 




  41  * that throws a runtime exception in its checkListen method, this
  42  * will cause rmiregistry and rmid to exit early because those
  43  * utilities will be unable to export any remote objects; test fails
  44  * if registry and rmid take too long to exit.
  45  */
  46 public class AltSecurityManager implements Runnable {
  47     private final int regPort;
  48     // variable to hold registry and rmid children
  49     static JavaVM vm = null;
  50 
  51     // names of utilities
  52     static String utilityToStart = null;
  53     static final String REGISTRY_IMPL = "sun.rmi.registry.RegistryImpl";
  54     static final String ACTIVATION = "sun.rmi.server.Activation";
  55 
  56     // children should exit in at least this time.
  57     static long TIME_OUT = 15000;
  58 
  59     public AltSecurityManager(int port) {
  60         if (port <= 0) {
  61             TestLibrary.bomb("Port must be greater than 0.");
  62         }
  63 
  64         this.regPort = port;
  65     }
  66 
  67     public void run() {
  68         try {
  69             if (utilityToStart.equals(REGISTRY_IMPL)) {
  70                 vm = new JavaVM(utilityToStart,
  71                         " -Djava.security.manager=TestSecurityManager",
  72                         Integer.toString(regPort));
  73             } else if (utilityToStart.contains(ACTIVATION)) {
  74                 vm = new JavaVM(utilityToStart,
  75                         " -Djava.security.manager=TestSecurityManager",
  76                         "-port " + Integer.toString(regPort));
  77             } else {
  78                 TestLibrary.bomb("Utility to start must be " + REGISTRY_IMPL +
  79                         " or " + ACTIVATION);
  80             }
  81 


< prev index next >