changeset 27784:a51d6d4e0528

8035000: clean up ActivationLibrary.DestroyThread Reviewed-by: lancea
author smarks
date Mon, 01 Dec 2014 17:59:39 -0800
parents 6317ec69db47
children 29d4cb4a8f5e
files jdk/test/java/rmi/activation/Activatable/checkActivateRef/CheckActivateRef.java jdk/test/java/rmi/activation/Activatable/checkAnnotations/CheckAnnotations.java jdk/test/java/rmi/activation/Activatable/checkImplClassLoader/CheckImplClassLoader.java jdk/test/java/rmi/activation/Activatable/checkRegisterInLog/CheckRegisterInLog.java jdk/test/java/rmi/activation/Activatable/createPrivateActivable/CreatePrivateActivatable.java jdk/test/java/rmi/activation/Activatable/downloadParameterClass/DownloadParameterClass.java jdk/test/java/rmi/activation/Activatable/elucidateNoSuchMethod/ElucidateNoSuchMethod.java jdk/test/java/rmi/activation/Activatable/extLoadedImpl/ExtLoadedImplTest.java jdk/test/java/rmi/activation/Activatable/forceLogSnapshot/ForceLogSnapshot.java jdk/test/java/rmi/activation/Activatable/inactiveGroup/InactiveGroup.java jdk/test/java/rmi/activation/Activatable/lookupActivationSystem/LookupActivationSystem.java jdk/test/java/rmi/activation/Activatable/nestedActivate/NestedActivate.java jdk/test/java/rmi/activation/Activatable/nonExistentActivatable/NonExistentActivatable.java jdk/test/java/rmi/activation/Activatable/restartCrashedService/RestartCrashedService.java jdk/test/java/rmi/activation/Activatable/restartLatecomer/RestartLatecomer.java jdk/test/java/rmi/activation/Activatable/restartService/RestartService.java jdk/test/java/rmi/activation/Activatable/unregisterInactive/UnregisterInactive.java jdk/test/java/rmi/activation/ActivateFailedException/activateFails/ActivateFails.java jdk/test/java/rmi/activation/ActivationGroup/downloadActivationGroup/DownloadActivationGroup.java jdk/test/java/rmi/activation/ActivationSystem/activeGroup/IdempotentActiveGroup.java jdk/test/java/rmi/activation/ActivationSystem/modifyDescriptor/ModifyDescriptor.java jdk/test/java/rmi/activation/ActivationSystem/stubClassesPermitted/StubClassesPermitted.java jdk/test/java/rmi/activation/ActivationSystem/unregisterGroup/UnregisterGroup.java jdk/test/java/rmi/activation/CommandEnvironment/SetChildEnv.java jdk/test/java/rmi/activation/rmidViaInheritedChannel/InheritedChannelNotServerSocket.java jdk/test/java/rmi/activation/rmidViaInheritedChannel/RmidViaInheritedChannel.java jdk/test/java/rmi/registry/altSecurityManager/AltSecurityManager.java jdk/test/java/rmi/server/RMISocketFactory/useSocketFactory/activatable/UseCustomSocketFactory.java jdk/test/java/rmi/testlibrary/ActivationLibrary.java jdk/test/java/rmi/testlibrary/RMID.java
diffstat 30 files changed, 158 insertions(+), 233 deletions(-) [+]
line wrap: on
line diff
--- a/jdk/test/java/rmi/activation/Activatable/checkActivateRef/CheckActivateRef.java	Mon Dec 01 21:02:21 2014 +0100
+++ b/jdk/test/java/rmi/activation/Activatable/checkActivateRef/CheckActivateRef.java	Mon Dec 01 17:59:39 2014 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -262,7 +262,7 @@
                              e.getClass().getName(), e);
 
         } finally {
-            ActivationLibrary.rmidCleanup(rmid);
+            rmid.cleanup();
             obj = null;
         }
     }
--- a/jdk/test/java/rmi/activation/Activatable/checkAnnotations/CheckAnnotations.java	Mon Dec 01 21:02:21 2014 +0100
+++ b/jdk/test/java/rmi/activation/Activatable/checkAnnotations/CheckAnnotations.java	Mon Dec 01 17:59:39 2014 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -130,7 +130,7 @@
 
             myRMI = null;
             System.err.println("rmid shut down");
-            ActivationLibrary.rmidCleanup(rmid);
+            rmid.cleanup();
         }
     }
 
--- a/jdk/test/java/rmi/activation/Activatable/checkImplClassLoader/CheckImplClassLoader.java	Mon Dec 01 21:02:21 2014 +0100
+++ b/jdk/test/java/rmi/activation/Activatable/checkImplClassLoader/CheckImplClassLoader.java	Mon Dec 01 17:59:39 2014 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -112,7 +112,7 @@
 
             myRMI = null;
             System.err.println("rmid shut down");
-            ActivationLibrary.rmidCleanup(rmid);
+            rmid.cleanup();
             TestLibrary.unexport(group);
         }
     }
--- a/jdk/test/java/rmi/activation/Activatable/checkRegisterInLog/CheckRegisterInLog.java	Mon Dec 01 21:02:21 2014 +0100
+++ b/jdk/test/java/rmi/activation/Activatable/checkRegisterInLog/CheckRegisterInLog.java	Mon Dec 01 17:59:39 2014 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -164,7 +164,7 @@
             throw new RuntimeException("CheckRegisterInLog got exception " +
                                        e.getMessage());
         } finally {
-            ActivationLibrary.rmidCleanup(rmid);
+            rmid.cleanup();
         }
     }
 }
--- a/jdk/test/java/rmi/activation/Activatable/createPrivateActivable/CreatePrivateActivatable.java	Mon Dec 01 21:02:21 2014 +0100
+++ b/jdk/test/java/rmi/activation/Activatable/createPrivateActivable/CreatePrivateActivatable.java	Mon Dec 01 17:59:39 2014 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -155,7 +155,7 @@
                              e.getClass().getName(), e);
 
         } finally {
-            ActivationLibrary.rmidCleanup(rmid);
+            rmid.cleanup();
             obj = null;
         }
     }
--- a/jdk/test/java/rmi/activation/Activatable/downloadParameterClass/DownloadParameterClass.java	Mon Dec 01 21:02:21 2014 +0100
+++ b/jdk/test/java/rmi/activation/Activatable/downloadParameterClass/DownloadParameterClass.java	Mon Dec 01 17:59:39 2014 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -138,7 +138,7 @@
         } catch (Exception e) {
             TestLibrary.bomb("test failed", e);
         } finally {
-            ActivationLibrary.rmidCleanup(rmid);
+            rmid.cleanup();
         }
     }
 }
--- a/jdk/test/java/rmi/activation/Activatable/elucidateNoSuchMethod/ElucidateNoSuchMethod.java	Mon Dec 01 21:02:21 2014 +0100
+++ b/jdk/test/java/rmi/activation/Activatable/elucidateNoSuchMethod/ElucidateNoSuchMethod.java	Mon Dec 01 17:59:39 2014 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -135,7 +135,7 @@
         } catch (Exception e) {
             TestLibrary.bomb("test failed", e);
         } finally {
-            ActivationLibrary.rmidCleanup(rmid);
+            rmid.cleanup();
         }
     }
 }
--- a/jdk/test/java/rmi/activation/Activatable/extLoadedImpl/ExtLoadedImplTest.java	Mon Dec 01 21:02:21 2014 +0100
+++ b/jdk/test/java/rmi/activation/Activatable/extLoadedImpl/ExtLoadedImplTest.java	Mon Dec 01 17:59:39 2014 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -69,7 +69,7 @@
         } catch (Exception e) {
             TestLibrary.bomb("test failed", e);
         } finally {
-            ActivationLibrary.rmidCleanup(rmid);
+            rmid.cleanup();
         }
     }
 }
--- a/jdk/test/java/rmi/activation/Activatable/forceLogSnapshot/ForceLogSnapshot.java	Mon Dec 01 21:02:21 2014 +0100
+++ b/jdk/test/java/rmi/activation/Activatable/forceLogSnapshot/ForceLogSnapshot.java	Mon Dec 01 17:59:39 2014 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -248,7 +248,7 @@
         } catch (Exception e) {
             TestLibrary.bomb("test failed", e);
         } finally {
-            ActivationLibrary.rmidCleanup(rmid);
+            rmid.cleanup();
             for (int i = 0 ; i < HOW_MANY ; i ++) {
                 TestLibrary.unexport(unicastObjs[i]);
             }
--- a/jdk/test/java/rmi/activation/Activatable/inactiveGroup/InactiveGroup.java	Mon Dec 01 21:02:21 2014 +0100
+++ b/jdk/test/java/rmi/activation/Activatable/inactiveGroup/InactiveGroup.java	Mon Dec 01 17:59:39 2014 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -176,7 +176,7 @@
         } catch (Exception e) {
             TestLibrary.bomb("test failed", e);
         } finally {
-            ActivationLibrary.rmidCleanup(rmid);
+            rmid.cleanup();
         }
     }
 }
--- a/jdk/test/java/rmi/activation/Activatable/lookupActivationSystem/LookupActivationSystem.java	Mon Dec 01 21:02:21 2014 +0100
+++ b/jdk/test/java/rmi/activation/Activatable/lookupActivationSystem/LookupActivationSystem.java	Mon Dec 01 17:59:39 2014 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -118,7 +118,7 @@
 
 
         } finally {
-            ActivationLibrary.rmidCleanup(rmid);
+            rmid.cleanup();
         }
     }
 }
--- a/jdk/test/java/rmi/activation/Activatable/nestedActivate/NestedActivate.java	Mon Dec 01 21:02:21 2014 +0100
+++ b/jdk/test/java/rmi/activation/Activatable/nestedActivate/NestedActivate.java	Mon Dec 01 17:59:39 2014 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -165,7 +165,7 @@
         } catch (Exception e) {
             TestLibrary.bomb("test failed", e);
         } finally {
-            ActivationLibrary.rmidCleanup(rmid);
+            rmid.cleanup();
         }
     }
 }
--- a/jdk/test/java/rmi/activation/Activatable/nonExistentActivatable/NonExistentActivatable.java	Mon Dec 01 21:02:21 2014 +0100
+++ b/jdk/test/java/rmi/activation/Activatable/nonExistentActivatable/NonExistentActivatable.java	Mon Dec 01 17:59:39 2014 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -139,7 +139,7 @@
         } catch (Exception e) {
             TestLibrary.bomb("test failed", e);
         } finally {
-            ActivationLibrary.rmidCleanup(rmid);
+            rmid.cleanup();
         }
     }
 }
--- a/jdk/test/java/rmi/activation/Activatable/restartCrashedService/RestartCrashedService.java	Mon Dec 01 21:02:21 2014 +0100
+++ b/jdk/test/java/rmi/activation/Activatable/restartCrashedService/RestartCrashedService.java	Mon Dec 01 17:59:39 2014 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -231,7 +231,7 @@
         } catch (Exception e) {
             TestLibrary.bomb("test failed", e);
         } finally {
-            ActivationLibrary.rmidCleanup(rmid);
+            rmid.cleanup();
             TestLibrary.unexport(unicastObj);
         }
     }
--- a/jdk/test/java/rmi/activation/Activatable/restartLatecomer/RestartLatecomer.java	Mon Dec 01 21:02:21 2014 +0100
+++ b/jdk/test/java/rmi/activation/Activatable/restartLatecomer/RestartLatecomer.java	Mon Dec 01 17:59:39 2014 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -247,7 +247,7 @@
         } catch (Exception e) {
             TestLibrary.bomb(e);
         } finally {
-            ActivationLibrary.rmidCleanup(rmid);
+            rmid.cleanup();
             TestLibrary.unexport(callbackObj);
         }
     }
--- a/jdk/test/java/rmi/activation/Activatable/restartService/RestartService.java	Mon Dec 01 21:02:21 2014 +0100
+++ b/jdk/test/java/rmi/activation/Activatable/restartService/RestartService.java	Mon Dec 01 17:59:39 2014 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -221,7 +221,7 @@
         } catch (Exception e) {
             TestLibrary.bomb("test failed", e);
         } finally {
-            ActivationLibrary.rmidCleanup(rmid);
+            rmid.cleanup();
             TestLibrary.unexport(unicastObj);
         }
     }
--- a/jdk/test/java/rmi/activation/Activatable/unregisterInactive/UnregisterInactive.java	Mon Dec 01 21:02:21 2014 +0100
+++ b/jdk/test/java/rmi/activation/Activatable/unregisterInactive/UnregisterInactive.java	Mon Dec 01 17:59:39 2014 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -125,7 +125,7 @@
         } catch (Exception e) {
             TestLibrary.bomb("test failed", e);
         } finally {
-            ActivationLibrary.rmidCleanup(rmid);
+            rmid.cleanup();
         }
     }
 }
--- a/jdk/test/java/rmi/activation/ActivateFailedException/activateFails/ActivateFails.java	Mon Dec 01 21:02:21 2014 +0100
+++ b/jdk/test/java/rmi/activation/ActivateFailedException/activateFails/ActivateFails.java	Mon Dec 01 17:59:39 2014 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -163,7 +163,7 @@
 
         } finally {
             obj1 = obj2 = null;
-            ActivationLibrary.rmidCleanup(rmid);
+            rmid.cleanup();
         }
     }
 }
--- a/jdk/test/java/rmi/activation/ActivationGroup/downloadActivationGroup/DownloadActivationGroup.java	Mon Dec 01 21:02:21 2014 +0100
+++ b/jdk/test/java/rmi/activation/ActivationGroup/downloadActivationGroup/DownloadActivationGroup.java	Mon Dec 01 17:59:39 2014 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -156,7 +156,7 @@
         } catch (Exception e) {
             TestLibrary.bomb(e);
         } finally {
-            ActivationLibrary.rmidCleanup(rmid);
+            rmid.cleanup();
         }
     }
 }
--- a/jdk/test/java/rmi/activation/ActivationSystem/activeGroup/IdempotentActiveGroup.java	Mon Dec 01 21:02:21 2014 +0100
+++ b/jdk/test/java/rmi/activation/ActivationSystem/activeGroup/IdempotentActiveGroup.java	Mon Dec 01 17:59:39 2014 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -108,7 +108,7 @@
             } catch (NoSuchObjectException unexpected) {
                 throw new AssertionError(unexpected);
             }
-            ActivationLibrary.rmidCleanup(rmid);
+            rmid.cleanup();
         }
     }
 
--- a/jdk/test/java/rmi/activation/ActivationSystem/modifyDescriptor/ModifyDescriptor.java	Mon Dec 01 21:02:21 2014 +0100
+++ b/jdk/test/java/rmi/activation/ActivationSystem/modifyDescriptor/ModifyDescriptor.java	Mon Dec 01 17:59:39 2014 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -250,7 +250,7 @@
         } catch (Exception e) {
             TestLibrary.bomb("test failed", e);
         } finally {
-            ActivationLibrary.rmidCleanup(rmid);
+            rmid.cleanup();
         }
     }
 }
--- a/jdk/test/java/rmi/activation/ActivationSystem/stubClassesPermitted/StubClassesPermitted.java	Mon Dec 01 21:02:21 2014 +0100
+++ b/jdk/test/java/rmi/activation/ActivationSystem/stubClassesPermitted/StubClassesPermitted.java	Mon Dec 01 17:59:39 2014 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -171,7 +171,7 @@
             }
 
             canCreateStubs = null;
-            ActivationLibrary.rmidCleanup(rmid);
+            rmid.cleanup();
             System.err.println("rmid shut down");
         }
     }
--- a/jdk/test/java/rmi/activation/ActivationSystem/unregisterGroup/UnregisterGroup.java	Mon Dec 01 21:02:21 2014 +0100
+++ b/jdk/test/java/rmi/activation/ActivationSystem/unregisterGroup/UnregisterGroup.java	Mon Dec 01 17:59:39 2014 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -156,7 +156,7 @@
         } catch (Exception e) {
             TestLibrary.bomb("test failed", e);
         } finally {
-            ActivationLibrary.rmidCleanup(rmid);
+            rmid.cleanup();
         }
     }
 }
--- a/jdk/test/java/rmi/activation/CommandEnvironment/SetChildEnv.java	Mon Dec 01 21:02:21 2014 +0100
+++ b/jdk/test/java/rmi/activation/CommandEnvironment/SetChildEnv.java	Mon Dec 01 17:59:39 2014 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -203,7 +203,7 @@
         actsys.unregisterGroup(gid);
 
         Thread.sleep(5000);
-        ActivationLibrary.rmidCleanup(rmid);
+        rmid.cleanup();
     }
 
     public static class DebugExecWatcher
--- a/jdk/test/java/rmi/activation/rmidViaInheritedChannel/InheritedChannelNotServerSocket.java	Mon Dec 01 21:02:21 2014 +0100
+++ b/jdk/test/java/rmi/activation/rmidViaInheritedChannel/InheritedChannelNotServerSocket.java	Mon Dec 01 17:59:39 2014 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -121,7 +121,7 @@
             if (obj != null) {
                 UnicastRemoteObject.unexportObject(obj, true);
             }
-            ActivationLibrary.rmidCleanup(rmid);
+            rmid.cleanup();
         }
     }
 
--- a/jdk/test/java/rmi/activation/rmidViaInheritedChannel/RmidViaInheritedChannel.java	Mon Dec 01 21:02:21 2014 +0100
+++ b/jdk/test/java/rmi/activation/rmidViaInheritedChannel/RmidViaInheritedChannel.java	Mon Dec 01 17:59:39 2014 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -119,7 +119,7 @@
             if (obj != null) {
                 UnicastRemoteObject.unexportObject(obj, true);
             }
-            ActivationLibrary.rmidCleanup(rmid);
+            rmid.cleanup();
         }
     }
 
--- a/jdk/test/java/rmi/registry/altSecurityManager/AltSecurityManager.java	Mon Dec 01 21:02:21 2014 +0100
+++ b/jdk/test/java/rmi/registry/altSecurityManager/AltSecurityManager.java	Mon Dec 01 17:59:39 2014 -0800
@@ -104,13 +104,6 @@
                                utilityToStart + " to die");
 
             if (time >= TIME_OUT) {
-
-                // dont pollute other tests; increase the likelihood
-                // that rmid will go away if it did not exit already.
-                if (utility.equals(ACTIVATION)) {
-                    RMID.shutdown(port);
-                }
-
                 TestLibrary.bomb(utilityToStart +
                                  " took too long to die...");
             } else {
--- a/jdk/test/java/rmi/server/RMISocketFactory/useSocketFactory/activatable/UseCustomSocketFactory.java	Mon Dec 01 21:02:21 2014 +0100
+++ b/jdk/test/java/rmi/server/RMISocketFactory/useSocketFactory/activatable/UseCustomSocketFactory.java	Mon Dec 01 17:59:39 2014 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -57,7 +57,7 @@
         RMID rmid = null;
 
         try {
-            rmid = RMID.createRMID(true);
+            rmid = RMID.createRMID();
             rmid.addArguments(new String[] {
                 "-C-Djava.security.policy=" +
                     TestParams.defaultGroupPolicy +
--- a/jdk/test/java/rmi/testlibrary/ActivationLibrary.java	Mon Dec 01 21:02:21 2014 +0100
+++ b/jdk/test/java/rmi/testlibrary/ActivationLibrary.java	Mon Dec 01 17:59:39 2014 -0800
@@ -103,68 +103,4 @@
         } catch (NoSuchObjectException e) {
         }
     }
-
-    /** cleanup after rmid */
-    public static void rmidCleanup(RMID rmid) {
-        if (rmid != null) {
-            if (!ActivationLibrary.safeDestroy(rmid, SAFE_WAIT_TIME)) {
-                TestLibrary.bomb("rmid not destroyed in: " +
-                                 SAFE_WAIT_TIME +
-                                 " milliseconds");
-            }
-        }
-        RMID.removeLog();
-    }
-
-    /**
-     * Invoke shutdown on rmid in a way that will not cause a test
-     * to hang.
-     *
-     * @return whether or not shutdown completed succesfully in the
-     *         timeAllowed
-     */
-    private static boolean safeDestroy(RMID rmid, long timeAllowed) {
-        DestroyThread destroyThread = new DestroyThread(rmid);
-        destroyThread.start();
-
-        try {
-            destroyThread.join(timeAllowed);
-        } catch (InterruptedException ie) {
-            Thread.currentThread().interrupt();
-        }
-
-        return destroyThread.shutdownSucceeded();
-    }
-
-    /**
-     * Thread class to handle the destruction of rmid
-     */
-    private static class DestroyThread extends Thread {
-        private final RMID rmid;
-        private final int port;
-        private boolean succeeded = false;
-
-        DestroyThread(RMID rmid) {
-            this.rmid = rmid;
-            this.port = rmid.getPort();
-            this.setDaemon(true);
-        }
-
-        public void run() {
-            if (RMID.lookupSystem(port) != null) {
-                rmid.destroy();
-                synchronized (this) {
-                    // flag that the test was able to shutdown rmid
-                    succeeded = true;
-                }
-                mesg("finished destroying rmid");
-            } else {
-                mesg("tried to shutdown when rmid was not running");
-            }
-        }
-
-        public synchronized boolean shutdownSucceeded() {
-            return succeeded;
-        }
-    }
 }
--- a/jdk/test/java/rmi/testlibrary/RMID.java	Mon Dec 01 21:02:21 2014 +0100
+++ b/jdk/test/java/rmi/testlibrary/RMID.java	Mon Dec 01 17:59:39 2014 -0800
@@ -21,14 +21,11 @@
  * questions.
  */
 
-/**
- *
- */
-
 import java.io.*;
 import java.rmi.*;
 import java.rmi.activation.*;
 import java.rmi.registry.*;
+import java.util.concurrent.TimeoutException;
 
 /**
  * Utility class that creates an instance of rmid with a policy
@@ -39,6 +36,14 @@
  */
 public class RMID extends JavaVM {
 
+    // TODO: adjust these based on the timeout factor
+    // such as jcov.sleep.multiplier; see start(long) method.
+    // Also consider the test.timeout.factor property (a float).
+    private static final long TIMEOUT_SHUTDOWN_MS = 60_000L;
+    private static final long TIMEOUT_DESTROY_MS  = 10_000L;
+    private static final long STARTTIME_MS        = 15_000L;
+    private static final long POLLTIME_MS         = 100L;
+
     private static final String SYSTEM_NAME = ActivationSystem.class.getName();
         // "java.rmi.activation.ActivationSystem"
 
@@ -140,15 +145,8 @@
      * policy file.
      */
     public static RMID createRMID() {
-        return createRMID(System.out, System.err, true);
-    }
-
-    public static RMID createRMID(boolean debugExec) {
-        return createRMID(System.out, System.err, debugExec);
-    }
-
-    public static RMID createRMID(OutputStream out, OutputStream err) {
-        return createRMID(out, err, true);
+        return createRMID(System.out, System.err, true, true,
+                          TestLibrary.getUnusedRandomPort());
     }
 
     public static RMID createRMID(OutputStream out, OutputStream err,
@@ -173,24 +171,24 @@
 
 
     /**
-     * Test RMID should be created with the createRMID method.
+     * Private constructor. RMID instances should be created
+     * using the static factory methods.
      */
-    protected RMID(String classname, String options, String args,
+    private RMID(String classname, String options, String args,
                    OutputStream out, OutputStream err, int port)
     {
         super(classname, options, args, out, err);
         this.port = port;
     }
 
+    /**
+     * Removes rmid's log file directory.
+     */
     public static void removeLog() {
-        /*
-         * Remove previous log file directory before
-         * starting up rmid.
-         */
         File f = new File(LOGDIR, log);
 
         if (f.exists()) {
-            mesg("removing rmid's old log file...");
+            mesg("Removing rmid's old log file.");
             String[] files = f.list();
 
             if (files != null) {
@@ -199,8 +197,8 @@
                 }
             }
 
-            if (f.delete() != true) {
-                mesg("\t" + " unable to delete old log file.");
+            if (! f.delete()) {
+                mesg("Warning: unable to delete old log file.");
             }
         }
     }
@@ -215,14 +213,6 @@
         return TestLibrary.getExtraProperty("rmid.jcov.args","");
     }
 
-    public void start() throws IOException {
-        start(10000);
-    }
-
-    public void slowStart() throws IOException {
-        start(60000);
-    }
-
     /**
      * Looks up the activation system in the registry on the given port,
      * returning its stub, or null if it's not present. This method differs from
@@ -239,12 +229,24 @@
         }
     }
 
+    /**
+     * Starts rmid and waits up to the default timeout period
+     * to confirm that it's running.
+     */
+    public void start() throws IOException {
+        start(STARTTIME_MS);
+    }
+
+    /**
+     * Starts rmid and waits up to the given timeout period
+     * to confirm that it's running.
+     */
     public void start(long waitTime) throws IOException {
 
         // if rmid is already running, then the test will fail with
         // a well recognized exception (port already in use...).
 
-        mesg("starting rmid on port #" + port + "...");
+        mesg("Starting rmid on port " + port + ".");
         super.start();
 
         int slopFactor = 1;
@@ -254,20 +256,17 @@
         } catch (NumberFormatException ignore) {}
         waitTime = waitTime * slopFactor;
 
-        // We check several times (as many as provides passed waitTime) to
-        // see if Rmid is currently running. Waiting steps last 100 msecs.
-        final long rmidStartSleepTime = 100;
+        // We check several times, for a maximum of waitTime, until we have
+        // verified that rmid is running.
         do {
-            // Sleeping for another rmidStartSleepTime time slice.
             try {
-                Thread.sleep(Math.min(waitTime, rmidStartSleepTime));
+                Thread.sleep(Math.min(waitTime, POLLTIME_MS));
             } catch (InterruptedException ie) {
                 Thread.currentThread().interrupt();
-                mesg("Thread interrupted while checking for start of Activation System. Giving up check.");
-                mesg("Activation System state unknown");
+                mesg("Interrupted while starting activation system, giving up.");
                 return;
             }
-            waitTime -= rmidStartSleepTime;
+            waitTime -= POLLTIME_MS;
 
             // Checking if rmid is present
             if (lookupSystem(port) != null) {
@@ -279,7 +278,7 @@
                  * incorrect value.
                  */
                 System.setProperty("java.rmi.activation.port", Integer.toString(port));
-                mesg("finished starting rmid.");
+                mesg("Started successfully.");
                 return;
             } else {
                 if (waitTime > 0) {
@@ -287,9 +286,15 @@
                 }
             }
         } while (waitTime > 0);
-        TestLibrary.bomb("start rmid failed... giving up", null);
+        TestLibrary.bomb("Failed to start rmid, giving up.", null);
     }
 
+    /**
+     * Destroys rmid and restarts it. Note that this does NOT clean up
+     * the log file, because it stores information about restartable
+     * and activatable objects that must be carried over to the new
+     * rmid instance.
+     */
     public void restart() throws IOException {
         destroy();
         start();
@@ -298,30 +303,35 @@
     /**
      * Ask rmid to shutdown gracefully using a remote method call.
      * catch any errors that might occur from rmid not being present
-     * at time of shutdown invocation.
-     *
-     * Shutdown does not nullify possible references to the rmid
-     * process object (destroy does though).
+     * at time of shutdown invocation. If the remote call is
+     * successful, wait for the process to terminate. Return true
+     * if the process terminated, otherwise return false.
      */
-    public static void shutdown(int port) {
+    private boolean shutdown() throws InterruptedException {
+        mesg("shutdown()");
+        ActivationSystem system = lookupSystem(port);
+        if (system == null) {
+            mesg("lookupSystem() returned null");
+            return false;
+        }
 
         try {
-            ActivationSystem system = lookupSystem(port);
-
-            if (system == null) {
-                TestLibrary.bomb("reference to the activation system was null");
-            }
-
+            mesg("ActivationSystem.shutdown()");
             system.shutdown();
-        } catch (RemoteException re) {
-            mesg("shutting down the activation daemon failed");
         } catch (Exception e) {
-            mesg("caught exception trying to shutdown rmid");
-            mesg(e.getMessage());
+            mesg("Caught exception from ActivationSystem.shutdown():");
             e.printStackTrace();
         }
 
-        mesg("testlibrary finished shutting down rmid");
+        try {
+            waitFor(TIMEOUT_SHUTDOWN_MS);
+            mesg("Shutdown successful.");
+            return true;
+        } catch (TimeoutException ex) {
+            mesg("Shutdown timed out:");
+            ex.printStackTrace();
+            return false;
+        }
     }
 
     /**
@@ -330,60 +340,46 @@
      * if rmid is a child process of the current VM.
      */
     public void destroy() {
-        // attempt graceful shutdown of the activation system
-        shutdown(port);
+        if (vm == null) {
+            throw new IllegalStateException("can't wait for RMID that isn't running");
+        }
 
-        if (vm != null) {
-            try {
-                /* Waiting for distant RMID process to shutdown.
-                 * Waiting is bounded at a hardcoded max of 60 secs (1 min).
-                 * Waiting by steps of 200 msecs, thus at most 300 such attempts
-                 * for termination of distant RMID process. If process is not
-                 * known to be terminated properly after that time,
-                 * we give up for a gracefull termination, and thus go for
-                 * forcibly destroying the process.
-                 */
-                boolean vmEnded = false;
-                int waitingTrials = 0;
-                final int maxTrials = 300;
-                final long vmProcessEndWaitInterval = 200;
-                int vmExitValue;
-                do {
-                    try {
-                        Thread.sleep(vmProcessEndWaitInterval);
-                        waitingTrials++;
-                        vmExitValue = vm.exitValue();
-                        mesg("rmid exited on shutdown request");
-                        vmEnded = true;
-                    } catch (IllegalThreadStateException illegal) {
-                        mesg("RMID's process still not terminated after more than " +
-                             (waitingTrials * vmProcessEndWaitInterval) + " milliseconds");
-                    }
+        // First, attempt graceful shutdown of the activation system.
+        try {
+            if (! shutdown()) {
+                // Graceful shutdown failed, use Process.destroy().
+                mesg("Destroying RMID process.");
+                vm.destroy();
+                try {
+                    waitFor(TIMEOUT_DESTROY_MS);
+                    mesg("Destroy successful.");
+                } catch (TimeoutException ex) {
+                    mesg("Destroy timed out, giving up.");
+                    ex.printStackTrace();
                 }
-                while (!vmEnded &&
-                       (waitingTrials < maxTrials));
+            }
+        } catch (InterruptedException ie) {
+            mesg("Shutdown/destroy interrupted, giving up.");
+            ie.printStackTrace();
+            Thread.currentThread().interrupt();
+            return;
+        }
 
-                if (waitingTrials >= maxTrials) {
-                    mesg("RMID's process still not terminated after more than " +
-                         (waitingTrials * vmProcessEndWaitInterval) + " milliseconds." +
-                         "Givinp up gracefull termination...");
-                    mesg("destroying RMID's process using Process.destroy()");
-                    super.destroy();
-                }
-
-            } catch (InterruptedException ie) {
-                Thread.currentThread().interrupt();
-                mesg("Thread interrupted while checking for termination of distant rmid vm. Giving up check.");
-            } catch (Exception e) {
-                mesg("caught unexpected exception trying to destroy rmid: " +
-                     e.getMessage());
-                e.printStackTrace();
-            }
-
-            // rmid will not restart if its process is not null
-            vm = null;
-        }
+        vm = null;
     }
 
-    public int getPort() {return port;}
+    /**
+     * Shuts down rmid and then removes its log file.
+     */
+    public void cleanup() {
+        destroy();
+        RMID.removeLog();
+    }
+
+    /**
+     * Gets the port on which this rmid is listening.
+     */
+    public int getPort() {
+        return port;
+    }
 }