corba/src/share/classes/com/sun/corba/se/impl/oa/poa/POAFactory.java
changeset 2664 a0a22a8f16bd
parent 4 02bb8761fcce
child 3291 805a72a26925
--- a/corba/src/share/classes/com/sun/corba/se/impl/oa/poa/POAFactory.java	Wed Jul 05 16:51:35 2017 +0200
+++ b/corba/src/share/classes/com/sun/corba/se/impl/oa/poa/POAFactory.java	Mon Apr 20 00:12:19 2009 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright 2002-2004 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2002-2007 Sun Microsystems, Inc.  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
@@ -76,6 +76,7 @@
     private ORB orb ;
     private POASystemException wrapper ;
     private OMGSystemException omgWrapper ;
+    private boolean isShuttingDown = false;
 
     public POASystemException getWrapper()
     {
@@ -166,6 +167,7 @@
         // pm.deactivate removes itself from poaManagers!
         Iterator managers = null ;
         synchronized (this) {
+            isShuttingDown = true ;
             managers = (new HashSet(poaManagers)).iterator();
         }
 
@@ -208,9 +210,15 @@
             ClosureFactory.makeFuture( rpClosure ) ) ;
     }
 
+
     public synchronized POA getRootPOA()
     {
         if (rootPOA == null) {
+            // See if we are trying to getRootPOA while shutting down the ORB.
+            if (isShuttingDown) {
+                throw omgWrapper.noObjectAdaptor( ) ;
+            }
+
             try {
                 Object obj = orb.resolve_initial_references(
                     ORBConstants.ROOT_POA_NAME ) ;