< prev index next >

test/java/rmi/activation/Activatable/restartCrashedService/RestartCrashedService.java

Print this page




   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */
  23 
  24 /* @test
  25  * @bug 4095165
  26  * @bug 4140736
  27  * @summary synopsis: rmid should waitFor restartable objects that crash and restart them
  28  * @author Ann Wollrath
  29  *
  30  * @library ../../../testlibrary
  31  * @modules java.rmi/sun.rmi.registry
  32  *          java.rmi/sun.rmi.server
  33  *          java.rmi/sun.rmi.transport
  34  *          java.rmi/sun.rmi.transport.tcp
  35  * @build TestLibrary RMID ActivateMe RestartCrashedService_Stub
  36  * @run main/othervm/policy=security.policy/timeout=240 RestartCrashedService
  37  */
  38 
  39 import java.io.*;
  40 import java.rmi.*;
  41 import java.rmi.activation.*;
  42 import java.rmi.server.*;
  43 import java.rmi.registry.*;
  44 import java.util.Vector;
  45 import java.util.Properties;
  46 


 101     }
 102 
 103     public void crash() {
 104         System.exit(0);
 105     }
 106 
 107     public ActivationID getID() {
 108         return id;
 109     }
 110 
 111     public static void main(String[] args) {
 112 
 113         System.out.println("\nRegression test for bug 4095165, 4140736\n");
 114 
 115         TestLibrary.suggestSecurityManager("java.rmi.RMISecurityManager");
 116 
 117         RMID rmid = null;
 118         RestartCrashedService unicastObj = null;
 119 
 120         try {
 121             RMID.removeLog();
 122             rmid = RMID.createRMID();
 123             rmid.start();
 124 
 125             /* Cause activation groups to have a security policy that will
 126              * allow security managers to be downloaded and installed
 127              */
 128             final Properties p = new Properties();
 129             // this test must always set policies/managers in its
 130             // activation groups
 131             p.put("java.security.policy",
 132                   TestParams.defaultGroupPolicy);
 133             p.put("java.security.manager",
 134                   TestParams.defaultSecurityManager);
 135 
 136             /*
 137              * Create unicast object to be contacted when service is activated.
 138              */
 139             unicastObj = new RestartCrashedService();
 140             /*
 141              * Create and register descriptors for a restartable and
 142              * non-restartable service (respectively) in a group other than
 143              * this VM's group.




   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */
  23 
  24 /* @test
  25  * @bug 4095165 4140736 8085192

  26  * @summary synopsis: rmid should waitFor restartable objects that crash and restart them
  27  * @author Ann Wollrath
  28  *
  29  * @library ../../../testlibrary
  30  * @modules java.rmi/sun.rmi.registry
  31  *          java.rmi/sun.rmi.server
  32  *          java.rmi/sun.rmi.transport
  33  *          java.rmi/sun.rmi.transport.tcp
  34  * @build TestLibrary RMID ActivateMe RestartCrashedService_Stub
  35  * @run main/othervm/policy=security.policy/timeout=240 RestartCrashedService
  36  */
  37 
  38 import java.io.*;
  39 import java.rmi.*;
  40 import java.rmi.activation.*;
  41 import java.rmi.server.*;
  42 import java.rmi.registry.*;
  43 import java.util.Vector;
  44 import java.util.Properties;
  45 


 100     }
 101 
 102     public void crash() {
 103         System.exit(0);
 104     }
 105 
 106     public ActivationID getID() {
 107         return id;
 108     }
 109 
 110     public static void main(String[] args) {
 111 
 112         System.out.println("\nRegression test for bug 4095165, 4140736\n");
 113 
 114         TestLibrary.suggestSecurityManager("java.rmi.RMISecurityManager");
 115 
 116         RMID rmid = null;
 117         RestartCrashedService unicastObj = null;
 118 
 119         try {
 120             rmid = RMID.launch();


 121 
 122             /* Cause activation groups to have a security policy that will
 123              * allow security managers to be downloaded and installed
 124              */
 125             final Properties p = new Properties();
 126             // this test must always set policies/managers in its
 127             // activation groups
 128             p.put("java.security.policy",
 129                   TestParams.defaultGroupPolicy);
 130             p.put("java.security.manager",
 131                   TestParams.defaultSecurityManager);
 132 
 133             /*
 134              * Create unicast object to be contacted when service is activated.
 135              */
 136             unicastObj = new RestartCrashedService();
 137             /*
 138              * Create and register descriptors for a restartable and
 139              * non-restartable service (respectively) in a group other than
 140              * this VM's group.


< prev index next >