< prev index next >

test/java/rmi/activation/Activatable/restartLatecomer/RestartLatecomer.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 4526514
  26  * @summary rmid does not handle group restart for latecomer objects
  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 ActivationLibrary
  35  *     RestartLatecomer RestartLatecomer_Stub
  36  * @run main/othervm/policy=security.policy/timeout=240 RestartLatecomer
  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;


 148     /**
 149      * Thread to deactivate object. First attempts to make object
 150      * inactive (via the inactive method).  If that fails (the
 151      * object may still have pending/executing calls), then
 152      * unexport the object forcibly.
 153      */
 154     public void run() {
 155         System.exit(0);
 156     }
 157 
 158     public static void main(String[] args) {
 159 
 160         System.out.println("\nRegression test for bug 4526514\n");
 161 
 162         TestLibrary.suggestSecurityManager("java.rmi.RMISecurityManager");
 163 
 164         RMID rmid = null;
 165         RestartLatecomer callbackObj = null;
 166 
 167         try {
 168             RMID.removeLog();
 169             rmid = RMID.createRMID();
 170             rmid.start();
 171 
 172             /* Cause activation groups to have a security policy that will
 173              * allow security managers to be downloaded and installed
 174              */
 175             Properties p = new Properties();
 176             // this test must always set policies/managers in its
 177             // activation groups
 178             p.put("java.security.policy",
 179                   TestParams.defaultGroupPolicy);
 180             p.put("java.security.manager",
 181                   TestParams.defaultSecurityManager);
 182 
 183             /*
 184              * Create unicast object to be contacted when service is activated.
 185              */
 186             callbackObj = new RestartLatecomer();
 187             /*
 188              * Create and register descriptors for a restartable and
 189              * non-restartable service (respectively) in a group other than
 190              * 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 4526514 8085192
  26  * @summary rmid does not handle group restart for latecomer objects
  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 ActivationLibrary
  35  *     RestartLatecomer RestartLatecomer_Stub
  36  * @run main/othervm/policy=security.policy/timeout=240 RestartLatecomer
  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;


 148     /**
 149      * Thread to deactivate object. First attempts to make object
 150      * inactive (via the inactive method).  If that fails (the
 151      * object may still have pending/executing calls), then
 152      * unexport the object forcibly.
 153      */
 154     public void run() {
 155         System.exit(0);
 156     }
 157 
 158     public static void main(String[] args) {
 159 
 160         System.out.println("\nRegression test for bug 4526514\n");
 161 
 162         TestLibrary.suggestSecurityManager("java.rmi.RMISecurityManager");
 163 
 164         RMID rmid = null;
 165         RestartLatecomer callbackObj = null;
 166 
 167         try {
 168             rmid = RMID.launch();


 169 
 170             /* Cause activation groups to have a security policy that will
 171              * allow security managers to be downloaded and installed
 172              */
 173             Properties p = new Properties();
 174             // this test must always set policies/managers in its
 175             // activation groups
 176             p.put("java.security.policy",
 177                   TestParams.defaultGroupPolicy);
 178             p.put("java.security.manager",
 179                   TestParams.defaultSecurityManager);
 180 
 181             /*
 182              * Create unicast object to be contacted when service is activated.
 183              */
 184             callbackObj = new RestartLatecomer();
 185             /*
 186              * Create and register descriptors for a restartable and
 187              * non-restartable service (respectively) in a group other than
 188              * this VM's group.


< prev index next >