src/java.corba/share/classes/com/sun/corba/se/impl/orb/ORBImpl.java
changeset 48554 592e22777742
parent 47216 71c04702a3d5
equal deleted inserted replaced
48498:c94c352dc400 48554:592e22777742
     1 /*
     1 /*
     2  * Copyright (c) 2002, 2015, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2002, 2017, 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
    52 
    52 
    53 import java.net.InetAddress;
    53 import java.net.InetAddress;
    54 
    54 
    55 import java.security.PrivilegedAction;
    55 import java.security.PrivilegedAction;
    56 import java.security.AccessController;
    56 import java.security.AccessController;
       
    57 import java.security.Security;
    57 
    58 
    58 import javax.rmi.CORBA.Util;
    59 import javax.rmi.CORBA.Util;
    59 import javax.rmi.CORBA.ValueHandler;
    60 import javax.rmi.CORBA.ValueHandler;
    60 
    61 
    61 import org.omg.CORBA.Context;
    62 import org.omg.CORBA.Context;
    88 import com.sun.corba.se.pept.transport.ContactInfo;
    89 import com.sun.corba.se.pept.transport.ContactInfo;
    89 import com.sun.corba.se.pept.transport.ConnectionCache;
    90 import com.sun.corba.se.pept.transport.ConnectionCache;
    90 import com.sun.corba.se.pept.transport.TransportManager;
    91 import com.sun.corba.se.pept.transport.TransportManager;
    91 
    92 
    92 import com.sun.corba.se.spi.ior.IOR;
    93 import com.sun.corba.se.spi.ior.IOR;
       
    94 import com.sun.corba.se.spi.ior.IORTypeCheckRegistry;
    93 import com.sun.corba.se.spi.ior.IdentifiableFactoryFinder;
    95 import com.sun.corba.se.spi.ior.IdentifiableFactoryFinder;
    94 import com.sun.corba.se.spi.ior.TaggedComponentFactoryFinder;
    96 import com.sun.corba.se.spi.ior.TaggedComponentFactoryFinder;
    95 import com.sun.corba.se.spi.ior.IORFactories;
    97 import com.sun.corba.se.spi.ior.IORFactories;
    96 import com.sun.corba.se.spi.ior.ObjectKey;
    98 import com.sun.corba.se.spi.ior.ObjectKey;
    97 import com.sun.corba.se.spi.ior.ObjectKeyFactory;
    99 import com.sun.corba.se.spi.ior.ObjectKeyFactory;
   122 import com.sun.corba.se.spi.orb.StringPair;
   124 import com.sun.corba.se.spi.orb.StringPair;
   123 import com.sun.corba.se.spi.orb.StringPair;
   125 import com.sun.corba.se.spi.orb.StringPair;
   124 import com.sun.corba.se.spi.transport.CorbaContactInfoListFactory;
   126 import com.sun.corba.se.spi.transport.CorbaContactInfoListFactory;
   125 import com.sun.corba.se.spi.transport.CorbaTransportManager;
   127 import com.sun.corba.se.spi.transport.CorbaTransportManager;
   126 import com.sun.corba.se.spi.legacy.connection.LegacyServerSocketManager;
   128 import com.sun.corba.se.spi.legacy.connection.LegacyServerSocketManager;
       
   129 import com.sun.corba.se.spi.logging.CORBALogDomains;
   127 import com.sun.corba.se.spi.copyobject.CopierManager;
   130 import com.sun.corba.se.spi.copyobject.CopierManager;
   128 import com.sun.corba.se.spi.presentation.rmi.PresentationDefaults;
   131 import com.sun.corba.se.spi.presentation.rmi.PresentationDefaults;
   129 import com.sun.corba.se.spi.presentation.rmi.PresentationManager;
   132 import com.sun.corba.se.spi.presentation.rmi.PresentationManager;
   130 import com.sun.corba.se.spi.presentation.rmi.StubAdapter;
   133 import com.sun.corba.se.spi.presentation.rmi.StubAdapter;
   131 import com.sun.corba.se.spi.servicecontext.ServiceContextRegistry;
   134 import com.sun.corba.se.spi.servicecontext.ServiceContextRegistry;
   143 import com.sun.corba.se.impl.dynamicany.DynAnyFactoryImpl;
   146 import com.sun.corba.se.impl.dynamicany.DynAnyFactoryImpl;
   144 import com.sun.corba.se.impl.encoding.EncapsOutputStream;
   147 import com.sun.corba.se.impl.encoding.EncapsOutputStream;
   145 import com.sun.corba.se.impl.encoding.CachedCodeBase;
   148 import com.sun.corba.se.impl.encoding.CachedCodeBase;
   146 import com.sun.corba.se.impl.interceptors.PIHandlerImpl;
   149 import com.sun.corba.se.impl.interceptors.PIHandlerImpl;
   147 import com.sun.corba.se.impl.interceptors.PINoOpHandlerImpl;
   150 import com.sun.corba.se.impl.interceptors.PINoOpHandlerImpl;
       
   151 import com.sun.corba.se.impl.ior.IORTypeCheckRegistryImpl;
   148 import com.sun.corba.se.impl.ior.TaggedComponentFactoryFinderImpl;
   152 import com.sun.corba.se.impl.ior.TaggedComponentFactoryFinderImpl;
   149 import com.sun.corba.se.impl.ior.TaggedProfileFactoryFinderImpl;
   153 import com.sun.corba.se.impl.ior.TaggedProfileFactoryFinderImpl;
   150 import com.sun.corba.se.impl.ior.TaggedProfileTemplateFactoryFinderImpl;
   154 import com.sun.corba.se.impl.ior.TaggedProfileTemplateFactoryFinderImpl;
   151 import com.sun.corba.se.impl.oa.toa.TOAFactory;
   155 import com.sun.corba.se.impl.oa.toa.TOAFactory;
   152 import com.sun.corba.se.impl.oa.poa.BadServerIdHandler;
   156 import com.sun.corba.se.impl.oa.poa.BadServerIdHandler;
   224 
   228 
   225     private int transientServerId ;
   229     private int transientServerId ;
   226 
   230 
   227     private ServiceContextRegistry serviceContextRegistry ;
   231     private ServiceContextRegistry serviceContextRegistry ;
   228 
   232 
       
   233     private IORTypeCheckRegistry iorTypeCheckRegistry;
       
   234 
   229     // Needed here to implement connect/disconnect
   235     // Needed here to implement connect/disconnect
   230     private TOAFactory toaFactory ;
   236     private TOAFactory toaFactory ;
   231 
   237 
   232     // Needed here for set_delegate
   238     // Needed here for set_delegate
   233     private POAFactory poaFactory ;
   239     private POAFactory poaFactory ;
   271     // resolverLock must be used for all access to either resolver or
   277     // resolverLock must be used for all access to either resolver or
   272     // localResolver, since it is possible for the resolver to indirectly
   278     // localResolver, since it is possible for the resolver to indirectly
   273     // refer to the localResolver.  Also used to protect access to
   279     // refer to the localResolver.  Also used to protect access to
   274     // insNamingDelegate.
   280     // insNamingDelegate.
   275     private final Object resolverLock = new Object() ;
   281     private final Object resolverLock = new Object() ;
       
   282 
       
   283     private static final String IORTYPECHECKREGISTRY_FILTER_PROPNAME = "com.sun.CORBA.ORBIorTypeCheckRegistryFilter";
   276 
   284 
   277     private TaggedComponentFactoryFinder taggedComponentFactoryFinder ;
   285     private TaggedComponentFactoryFinder taggedComponentFactoryFinder ;
   278 
   286 
   279     private IdentifiableFactoryFinder taggedProfileFactoryFinder ;
   287     private IdentifiableFactoryFinder taggedProfileFactoryFinder ;
   280 
   288 
   409                     return new StackImpl();
   417                     return new StackImpl();
   410                 }
   418                 }
   411             };
   419             };
   412 
   420 
   413         serviceContextRegistry = new ServiceContextRegistry( this ) ;
   421         serviceContextRegistry = new ServiceContextRegistry( this ) ;
       
   422 
       
   423     }
       
   424 
       
   425 
       
   426     private void initIORTypeCheckRegistry() {
       
   427         String filterProps = AccessController
       
   428                 .doPrivileged(new PrivilegedAction<String>() {
       
   429                     public String run() {
       
   430                         String props = System
       
   431                                 .getProperty(IORTYPECHECKREGISTRY_FILTER_PROPNAME);
       
   432                         if (props == null) {
       
   433                             props = Security
       
   434                                     .getProperty(IORTYPECHECKREGISTRY_FILTER_PROPNAME);
       
   435                         }
       
   436                         return props;
       
   437                     }
       
   438                 });
       
   439         if (filterProps != null) {
       
   440             try {
       
   441                 iorTypeCheckRegistry = new IORTypeCheckRegistryImpl(filterProps, this);
       
   442             } catch (Exception ex) {
       
   443                 throw wrapper.bootstrapException(ex);
       
   444             }
       
   445 
       
   446             if (this.orbInitDebugFlag) {
       
   447                 dprint(".initIORTypeCheckRegistry, IORTypeCheckRegistryImpl created for properties == "
       
   448                         + filterProps);
       
   449             }
       
   450         } else {
       
   451             if (this.orbInitDebugFlag) {
       
   452                 dprint(".initIORTypeCheckRegistry, IORTypeCheckRegistryImpl NOT created for properties == ");
       
   453             }
       
   454         }
   414     }
   455     }
   415 
   456 
   416     protected void setDebugFlags( String[] args )
   457     protected void setDebugFlags( String[] args )
   417     {
   458     {
   418         for (int ctr=0; ctr<args.length; ctr++ ) {
   459         for (int ctr=0; ctr<args.length; ctr++ ) {
   492         // Initialize the thread manager pool and byte buffer pool
   533         // Initialize the thread manager pool and byte buffer pool
   493         // so they may be initialized & accessed without synchronization
   534         // so they may be initialized & accessed without synchronization
   494         getThreadPoolManager();
   535         getThreadPoolManager();
   495 
   536 
   496         super.getByteBufferPool();
   537         super.getByteBufferPool();
       
   538 
       
   539         initIORTypeCheckRegistry();
   497     }
   540     }
   498 
   541 
   499     private synchronized POAFactory getPOAFactory()
   542     private synchronized POAFactory getPOAFactory()
   500     {
   543     {
   501         if (poaFactory == null) {
   544         if (poaFactory == null) {
  2087         synchronized (this) {
  2130         synchronized (this) {
  2088                 checkShutdownState();
  2131                 checkShutdownState();
  2089         }
  2132         }
  2090         return copierManager ;
  2133         return copierManager ;
  2091     }
  2134     }
       
  2135 
       
  2136     @Override
       
  2137     public void validateIORClass(String iorClassName) {
       
  2138         if (iorTypeCheckRegistry != null) {
       
  2139             if (!iorTypeCheckRegistry.isValidIORType(iorClassName)) {
       
  2140                 throw ORBUtilSystemException.get( this,
       
  2141                         CORBALogDomains.OA_IOR ).badStringifiedIor();
       
  2142             }
       
  2143         }
       
  2144     }
       
  2145 
  2092 } // Class ORBImpl
  2146 } // Class ORBImpl
  2093 
  2147 
  2094 ////////////////////////////////////////////////////////////////////////
  2148 ////////////////////////////////////////////////////////////////////////
  2095 /// Helper class for a Synchronization Variable
  2149 /// Helper class for a Synchronization Variable
  2096 ////////////////////////////////////////////////////////////////////////
  2150 ////////////////////////////////////////////////////////////////////////