src/share/classes/com/sun/corba/se/spi/orb/ORB.java

Print this page

        

@@ -1,7 +1,7 @@
 /*
- * Copyright (c) 2002, 2004, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2012, 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
  * under the terms of the GNU General Public License version 2 only, as
  * published by the Free Software Foundation.  Oracle designates this

@@ -169,11 +169,11 @@
     // representing LogDomain and ExceptionGroup.
     private Map wrapperMap ;
 
     private static Map staticWrapperMap = new ConcurrentHashMap();
 
-    private MonitoringManager monitoringManager;
+    protected MonitoringManager monitoringManager;
 
     // There is only one instance of the PresentationManager
     // that is shared between all ORBs.  This is necessary
     // because RMI-IIOP requires the PresentationManager in
     // places where no ORB is available, so the PresentationManager

@@ -224,10 +224,18 @@
         globalPM.setStubFactoryFactory( false,
             PresentationDefaults.getStaticStubFactoryFactory() ) ;
         globalPM.setStubFactoryFactory( true, dynamicStubFactoryFactory ) ;
     }
 
+    public void destroy() {
+        wrapper = null;
+        omgWrapper = null;
+        typeCodeMap = null;
+        primitiveTypeCodeConstants = null;
+        byteBufferPool = null;
+    }
+
     /** Get the single instance of the PresentationManager
      */
     public static PresentationManager getPresentationManager()
     {
         return globalPM ;

@@ -300,28 +308,36 @@
     }
 
     // Typecode support: needed in both ORBImpl and ORBSingleton
     public TypeCodeImpl get_primitive_tc(int kind)
     {
+        synchronized (this) {
+            checkShutdownState();
+        }
         try {
             return primitiveTypeCodeConstants[kind] ;
         } catch (Throwable t) {
             throw wrapper.invalidTypecodeKind( t, new Integer(kind) ) ;
         }
     }
 
     public synchronized void setTypeCode(String id, TypeCodeImpl code)
     {
+        checkShutdownState();
         typeCodeMap.put(id, code);
     }
 
     public synchronized TypeCodeImpl getTypeCode(String id)
     {
+        checkShutdownState();
         return (TypeCodeImpl)typeCodeMap.get(id);
     }
 
     public MonitoringManager getMonitoringManager( ) {
+        synchronized (this) {
+            checkShutdownState();
+        }
         return monitoringManager;
     }
 
     // Special non-standard set_parameters method for
     // creating a precisely controlled ORB instance.

@@ -432,10 +448,13 @@
     /**
      * Returns the logger based on the category.
      */
     public Logger getLogger( String domain )
     {
+        synchronized (this) {
+            checkShutdownState();
+        }
         ORBData odata = getORBData() ;
 
         // Determine the correct ORBId.  There are 3 cases:
         // 1. odata is null, which happens if we are getting a logger before
         //    ORB initialization is complete.  In this case we cannot determine

@@ -508,10 +527,13 @@
     // NOTE: ByteBuffer pool must be unique per ORB, not per process.
     //       There can be more than one ORB per process.
     //       This method must also be inherited by both ORB and ORBSingleton.
     public ByteBufferPool getByteBufferPool()
     {
+        synchronized (this) {
+            checkShutdownState();
+        }
         if (byteBufferPool == null)
             byteBufferPool = new ByteBufferPoolImpl(this);
 
         return byteBufferPool;
     }