< prev index next >

test/java/rmi/activation/Activatable/unregisterInactive/UnregisterInactive.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 4115331
  26  * @summary synopsis: activatable object fails to go inactive after
  27  * unregister/inactive sequence.
  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 ActivationLibrary ActivateMe UnregisterInactive_Stub
  36  * @run main/othervm/policy=security.policy/timeout=240 UnregisterInactive
  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.Properties;
  45 


  71 
  72     /**
  73      * Thread to deactivate object. First attempts to make object
  74      * inactive (via the inactive method).  If that fails (the
  75      * object may still have pending/executing calls), then
  76      * unexport the object forcibly.
  77      */
  78     public void run() {
  79         ActivationLibrary.deactivate(this, getID());
  80     }
  81 
  82     public static void main(String[] args) {
  83 
  84         System.out.println("\nRegression test for bug 4115331\n");
  85 
  86         TestLibrary.suggestSecurityManager("java.rmi.RMISecurityManager");
  87 
  88         RMID rmid = null;
  89 
  90         try {
  91             RMID.removeLog();
  92             rmid = RMID.createRMID();
  93             rmid.start();
  94             System.err.println("Creating descriptor");
  95 
  96 
  97             /* Cause activation groups to have a security policy that will
  98              * allow security managers to be downloaded and installed
  99              */
 100             Properties p = new Properties();
 101             // this test must always set policies/managers in its
 102             // activation groups
 103             p.put("java.security.policy",
 104                   TestParams.defaultGroupPolicy);
 105             p.put("java.security.manager",
 106                   TestParams.defaultSecurityManager);
 107 
 108             ActivationGroupDesc groupDesc =
 109                 new ActivationGroupDesc(p, null);
 110             ActivationSystem system = ActivationGroup.getSystem();
 111             ActivationGroupID groupID = system.registerGroup(groupDesc);
 112             ActivationGroup.createGroup(groupID, groupDesc, 0);
 113 




   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 4115331 8085192
  26  * @summary synopsis: activatable object fails to go inactive after
  27  * unregister/inactive sequence.
  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 ActivationLibrary ActivateMe UnregisterInactive_Stub
  36  * @run main/othervm/policy=security.policy/timeout=240 UnregisterInactive
  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.Properties;
  45 


  71 
  72     /**
  73      * Thread to deactivate object. First attempts to make object
  74      * inactive (via the inactive method).  If that fails (the
  75      * object may still have pending/executing calls), then
  76      * unexport the object forcibly.
  77      */
  78     public void run() {
  79         ActivationLibrary.deactivate(this, getID());
  80     }
  81 
  82     public static void main(String[] args) {
  83 
  84         System.out.println("\nRegression test for bug 4115331\n");
  85 
  86         TestLibrary.suggestSecurityManager("java.rmi.RMISecurityManager");
  87 
  88         RMID rmid = null;
  89 
  90         try {
  91             rmid = RMID.launch();


  92             System.err.println("Creating descriptor");
  93 
  94 
  95             /* Cause activation groups to have a security policy that will
  96              * allow security managers to be downloaded and installed
  97              */
  98             Properties p = new Properties();
  99             // this test must always set policies/managers in its
 100             // activation groups
 101             p.put("java.security.policy",
 102                   TestParams.defaultGroupPolicy);
 103             p.put("java.security.manager",
 104                   TestParams.defaultSecurityManager);
 105 
 106             ActivationGroupDesc groupDesc =
 107                 new ActivationGroupDesc(p, null);
 108             ActivationSystem system = ActivationGroup.getSystem();
 109             ActivationGroupID groupID = system.registerGroup(groupDesc);
 110             ActivationGroup.createGroup(groupID, groupDesc, 0);
 111 


< prev index next >