📄 orb.java
字号:
/* * @(#)ORB.java 1.55 05/11/17 * * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. */package com.sun.corba.se.spi.orb;import java.util.Map ;import java.util.HashMap ;import java.util.Properties ;import java.util.concurrent.ConcurrentHashMap;import java.util.logging.Logger ;import java.security.AccessController ;import java.security.PrivilegedAction ;import org.omg.CORBA.TCKind ;import com.sun.corba.se.pept.broker.Broker ;import com.sun.corba.se.pept.transport.ByteBufferPool;import com.sun.corba.se.spi.protocol.RequestDispatcherRegistry ;import com.sun.corba.se.spi.protocol.ClientDelegateFactory ;import com.sun.corba.se.spi.protocol.CorbaServerRequestDispatcher ;import com.sun.corba.se.spi.protocol.CorbaMessageMediator ;import com.sun.corba.se.spi.protocol.PIHandler ;import com.sun.corba.se.spi.resolver.LocalResolver ;import com.sun.corba.se.spi.resolver.Resolver ;import com.sun.corba.se.spi.transport.CorbaContactInfoListFactory ;import com.sun.corba.se.spi.legacy.connection.LegacyServerSocketEndPointInfo;import com.sun.corba.se.spi.legacy.connection.LegacyServerSocketManager;import com.sun.corba.se.spi.monitoring.MonitoringConstants;import com.sun.corba.se.spi.monitoring.MonitoringManager;import com.sun.corba.se.spi.monitoring.MonitoringManagerFactory;import com.sun.corba.se.spi.monitoring.MonitoringFactories;import com.sun.corba.se.spi.ior.IdentifiableFactoryFinder ;import com.sun.corba.se.spi.ior.TaggedComponentFactoryFinder ;import com.sun.corba.se.spi.ior.ObjectKey ;import com.sun.corba.se.spi.ior.ObjectKeyFactory ;import com.sun.corba.se.spi.ior.IOR ;import com.sun.corba.se.spi.orbutil.closure.Closure ;import com.sun.corba.se.spi.orb.Operation ;import com.sun.corba.se.spi.orb.ORBData ;import com.sun.corba.se.spi.orb.ORBVersion ;import com.sun.corba.se.spi.orbutil.threadpool.ThreadPoolManager;import com.sun.corba.se.spi.oa.OAInvocationInfo ;import com.sun.corba.se.spi.transport.CorbaTransportManager;import com.sun.corba.se.spi.logging.LogWrapperFactory ;import com.sun.corba.se.spi.logging.LogWrapperBase ;import com.sun.corba.se.spi.logging.CORBALogDomains ;import com.sun.corba.se.spi.copyobject.CopierManager ;import com.sun.corba.se.spi.presentation.rmi.PresentationManager ;import com.sun.corba.se.spi.presentation.rmi.PresentationDefaults ;import com.sun.corba.se.spi.servicecontext.ServiceContextRegistry ;// XXX needs an SPI or else it does not belong hereimport com.sun.corba.se.impl.corba.TypeCodeImpl ;import com.sun.corba.se.impl.corba.TypeCodeFactory ;// XXX Should there be a SPI level constants ?import com.sun.corba.se.impl.orbutil.ORBConstants ;import com.sun.corba.se.impl.oa.poa.BadServerIdHandler ;import com.sun.corba.se.impl.transport.ByteBufferPoolImpl;import com.sun.corba.se.impl.logging.ORBUtilSystemException ;import com.sun.corba.se.impl.logging.OMGSystemException ;import com.sun.corba.se.impl.presentation.rmi.PresentationManagerImpl ;import com.sun.corba.se.impl.orbutil.ORBClassLoader ;public abstract class ORB extends com.sun.corba.se.org.omg.CORBA.ORB implements Broker, TypeCodeFactory{ // As much as possible, this class should be stateless. However, // there are a few reasons why it is not: // // 1. The ORB debug flags are defined here because they are accessed // frequently, and we do not want a cast to the impl just for that. // 2. typeCodeMap and primitiveTypeCodeConstants are here because they // are needed in both ORBImpl and ORBSingleton. // 3. Logging support is here so that we can avoid problems with // incompletely initialized ORBs that need to perform logging. // Flag set at compile time to debug flag processing: this can't // be one of the xxxDebugFlags because it is used to debug the mechanism // that sets the xxxDebugFlags! public static boolean ORBInitDebug = false; // Currently defined debug flags. Any additions must be called xxxDebugFlag. // All debug flags must be public boolean types. // These are set by passing the flag -ORBDebug x,y,z in the ORB init args. // Note that x,y,z must not contain spaces. public boolean transportDebugFlag = false ; public boolean subcontractDebugFlag = false ; public boolean poaDebugFlag = false ; public boolean poaConcurrencyDebugFlag = false ; public boolean poaFSMDebugFlag = false ; public boolean orbdDebugFlag = false ; public boolean namingDebugFlag = false ; public boolean serviceContextDebugFlag = false ; public boolean transientObjectManagerDebugFlag = false ; public boolean giopVersionDebugFlag = false; public boolean shutdownDebugFlag = false; public boolean giopDebugFlag = false; public boolean invocationTimingDebugFlag = false ; // SystemException log wrappers. Protected so that they can be used in // subclasses. protected static ORBUtilSystemException staticWrapper ; protected ORBUtilSystemException wrapper ; protected OMGSystemException omgWrapper ; // This map is needed for resolving recursive type code placeholders // based on the unique repository id. // XXX Should this be a WeakHashMap for GC? private Map typeCodeMap ; private TypeCodeImpl[] primitiveTypeCodeConstants ; // ByteBufferPool - needed by both ORBImpl and ORBSingleton ByteBufferPool byteBufferPool; // Local testing // XXX clean this up, probably remove these public abstract boolean isLocalHost( String hostName ) ; public abstract boolean isLocalServerId( int subcontractId, int serverId ) ; // Invocation stack manipulation public abstract OAInvocationInfo peekInvocationInfo() ; public abstract void pushInvocationInfo( OAInvocationInfo info ) ; public abstract OAInvocationInfo popInvocationInfo() ; public abstract CorbaTransportManager getCorbaTransportManager(); public abstract LegacyServerSocketManager getLegacyServerSocketManager(); // wrapperMap maintains a table of LogWrapper instances used by // different classes to log exceptions. The key is a StringPair // representing LogDomain and ExceptionGroup. private Map wrapperMap ; private static Map staticWrapperMap = new ConcurrentHashMap(); private 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 // must be global. It is initialized here as well. protected static PresentationManager globalPM = null ; static { staticWrapper = ORBUtilSystemException.get( CORBALogDomains.RPC_PRESENTATION ) ; boolean useDynamicStub = ((Boolean)AccessController.doPrivileged( new PrivilegedAction() { public java.lang.Object run() { return Boolean.valueOf( Boolean.getBoolean ( ORBConstants.USE_DYNAMIC_STUB_PROPERTY ) ) ; } } )).booleanValue() ; PresentationManager.StubFactoryFactory dynamicStubFactoryFactory = (PresentationManager.StubFactoryFactory)AccessController.doPrivileged( new PrivilegedAction() { public java.lang.Object run() { PresentationManager.StubFactoryFactory sff = PresentationDefaults.getProxyStubFactoryFactory() ; String className = System.getProperty( ORBConstants.DYNAMIC_STUB_FACTORY_FACTORY_CLASS, "com.sun.corba.se.impl.presentation.rmi.bcel.StubFactoryFactoryBCELImpl" ) ; try { // First try the configured class name, if any Class cls = ORBClassLoader.loadClass( className ) ; sff = (PresentationManager.StubFactoryFactory)cls.newInstance() ; } catch (Exception exc) { // Use the default. Log the error as a warning. staticWrapper.errorInSettingDynamicStubFactoryFactory( exc, className ) ; } return sff ; } } ) ; globalPM = new PresentationManagerImpl( useDynamicStub ) ; globalPM.setStubFactoryFactory( false, PresentationDefaults.getStaticStubFactoryFactory() ) ; globalPM.setStubFactoryFactory( true, dynamicStubFactoryFactory ) ; } /** Get the single instance of the PresentationManager */ public static PresentationManager getPresentationManager() { return globalPM ; } /** Get the appropriate StubFactoryFactory. This * will be dynamic or static depending on whether * com.sun.CORBA.ORBUseDynamicStub is true or false. */ public static PresentationManager.StubFactoryFactory getStubFactoryFactory() { boolean useDynamicStubs = globalPM.useDynamicStubs() ; return globalPM.getStubFactoryFactory( useDynamicStubs ) ; } protected ORB() { // Initialize logging first, since it is needed nearly // everywhere (for example, in TypeCodeImpl). wrapperMap = new ConcurrentHashMap(); wrapper = ORBUtilSystemException.get( this, CORBALogDomains.RPC_PRESENTATION ) ; omgWrapper = OMGSystemException.get( this, CORBALogDomains.RPC_PRESENTATION ) ; typeCodeMap = new HashMap(); primitiveTypeCodeConstants = new TypeCodeImpl[] { new TypeCodeImpl(this, TCKind._tk_null), new TypeCodeImpl(this, TCKind._tk_void), new TypeCodeImpl(this, TCKind._tk_short), new TypeCodeImpl(this, TCKind._tk_long), new TypeCodeImpl(this, TCKind._tk_ushort), new TypeCodeImpl(this, TCKind._tk_ulong), new TypeCodeImpl(this, TCKind._tk_float), new TypeCodeImpl(this, TCKind._tk_double), new TypeCodeImpl(this, TCKind._tk_boolean), new TypeCodeImpl(this, TCKind._tk_char), new TypeCodeImpl(this, TCKind._tk_octet), new TypeCodeImpl(this, TCKind._tk_any), new TypeCodeImpl(this, TCKind._tk_TypeCode), new TypeCodeImpl(this, TCKind._tk_Principal),
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -