corba/src/share/classes/com/sun/corba/se/spi/orb/ORB.java
changeset 13171 1ac5e9a54a6e
parent 5555 b2b5ed3f0d0d
child 16138 0caa305dbb46
equal deleted inserted replaced
13082:9b19b2302c28 13171:1ac5e9a54a6e
     1 /*
     1 /*
     2  * Copyright (c) 2002, 2004, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     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
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.  Oracle designates this
     7  * published by the Free Software Foundation.  Oracle designates this
   169     // representing LogDomain and ExceptionGroup.
   169     // representing LogDomain and ExceptionGroup.
   170     private Map wrapperMap ;
   170     private Map wrapperMap ;
   171 
   171 
   172     private static Map staticWrapperMap = new ConcurrentHashMap();
   172     private static Map staticWrapperMap = new ConcurrentHashMap();
   173 
   173 
   174     private MonitoringManager monitoringManager;
   174     protected MonitoringManager monitoringManager;
   175 
   175 
   176     // There is only one instance of the PresentationManager
   176     // There is only one instance of the PresentationManager
   177     // that is shared between all ORBs.  This is necessary
   177     // that is shared between all ORBs.  This is necessary
   178     // because RMI-IIOP requires the PresentationManager in
   178     // because RMI-IIOP requires the PresentationManager in
   179     // places where no ORB is available, so the PresentationManager
   179     // places where no ORB is available, so the PresentationManager
   222 
   222 
   223         globalPM = new PresentationManagerImpl( useDynamicStub ) ;
   223         globalPM = new PresentationManagerImpl( useDynamicStub ) ;
   224         globalPM.setStubFactoryFactory( false,
   224         globalPM.setStubFactoryFactory( false,
   225             PresentationDefaults.getStaticStubFactoryFactory() ) ;
   225             PresentationDefaults.getStaticStubFactoryFactory() ) ;
   226         globalPM.setStubFactoryFactory( true, dynamicStubFactoryFactory ) ;
   226         globalPM.setStubFactoryFactory( true, dynamicStubFactoryFactory ) ;
       
   227     }
       
   228 
       
   229     public void destroy() {
       
   230         wrapper = null;
       
   231         omgWrapper = null;
       
   232         typeCodeMap = null;
       
   233         primitiveTypeCodeConstants = null;
       
   234         byteBufferPool = null;
   227     }
   235     }
   228 
   236 
   229     /** Get the single instance of the PresentationManager
   237     /** Get the single instance of the PresentationManager
   230      */
   238      */
   231     public static PresentationManager getPresentationManager()
   239     public static PresentationManager getPresentationManager()
   300     }
   308     }
   301 
   309 
   302     // Typecode support: needed in both ORBImpl and ORBSingleton
   310     // Typecode support: needed in both ORBImpl and ORBSingleton
   303     public TypeCodeImpl get_primitive_tc(int kind)
   311     public TypeCodeImpl get_primitive_tc(int kind)
   304     {
   312     {
       
   313         synchronized (this) {
       
   314             checkShutdownState();
       
   315         }
   305         try {
   316         try {
   306             return primitiveTypeCodeConstants[kind] ;
   317             return primitiveTypeCodeConstants[kind] ;
   307         } catch (Throwable t) {
   318         } catch (Throwable t) {
   308             throw wrapper.invalidTypecodeKind( t, new Integer(kind) ) ;
   319             throw wrapper.invalidTypecodeKind( t, new Integer(kind) ) ;
   309         }
   320         }
   310     }
   321     }
   311 
   322 
   312     public synchronized void setTypeCode(String id, TypeCodeImpl code)
   323     public synchronized void setTypeCode(String id, TypeCodeImpl code)
   313     {
   324     {
       
   325         checkShutdownState();
   314         typeCodeMap.put(id, code);
   326         typeCodeMap.put(id, code);
   315     }
   327     }
   316 
   328 
   317     public synchronized TypeCodeImpl getTypeCode(String id)
   329     public synchronized TypeCodeImpl getTypeCode(String id)
   318     {
   330     {
       
   331         checkShutdownState();
   319         return (TypeCodeImpl)typeCodeMap.get(id);
   332         return (TypeCodeImpl)typeCodeMap.get(id);
   320     }
   333     }
   321 
   334 
   322     public MonitoringManager getMonitoringManager( ) {
   335     public MonitoringManager getMonitoringManager( ) {
       
   336         synchronized (this) {
       
   337             checkShutdownState();
       
   338         }
   323         return monitoringManager;
   339         return monitoringManager;
   324     }
   340     }
   325 
   341 
   326     // Special non-standard set_parameters method for
   342     // Special non-standard set_parameters method for
   327     // creating a precisely controlled ORB instance.
   343     // creating a precisely controlled ORB instance.
   432     /**
   448     /**
   433      * Returns the logger based on the category.
   449      * Returns the logger based on the category.
   434      */
   450      */
   435     public Logger getLogger( String domain )
   451     public Logger getLogger( String domain )
   436     {
   452     {
       
   453         synchronized (this) {
       
   454             checkShutdownState();
       
   455         }
   437         ORBData odata = getORBData() ;
   456         ORBData odata = getORBData() ;
   438 
   457 
   439         // Determine the correct ORBId.  There are 3 cases:
   458         // Determine the correct ORBId.  There are 3 cases:
   440         // 1. odata is null, which happens if we are getting a logger before
   459         // 1. odata is null, which happens if we are getting a logger before
   441         //    ORB initialization is complete.  In this case we cannot determine
   460         //    ORB initialization is complete.  In this case we cannot determine
   508     // NOTE: ByteBuffer pool must be unique per ORB, not per process.
   527     // NOTE: ByteBuffer pool must be unique per ORB, not per process.
   509     //       There can be more than one ORB per process.
   528     //       There can be more than one ORB per process.
   510     //       This method must also be inherited by both ORB and ORBSingleton.
   529     //       This method must also be inherited by both ORB and ORBSingleton.
   511     public ByteBufferPool getByteBufferPool()
   530     public ByteBufferPool getByteBufferPool()
   512     {
   531     {
       
   532         synchronized (this) {
       
   533             checkShutdownState();
       
   534         }
   513         if (byteBufferPool == null)
   535         if (byteBufferPool == null)
   514             byteBufferPool = new ByteBufferPoolImpl(this);
   536             byteBufferPool = new ByteBufferPoolImpl(this);
   515 
   537 
   516         return byteBufferPool;
   538         return byteBufferPool;
   517     }
   539     }