FileDocCategorySizeDatePackage
ORBImpl.javaAPI DocJava SE 6 API59695Tue Jun 10 00:21:38 BST 2008com.sun.corba.se.impl.orb

ORBImpl

public class ORBImpl extends ORB
The JavaIDL ORB implementation.

Fields Summary
protected TransportManager
transportManager
protected LegacyServerSocketManager
legacyServerSocketManager
private ThreadLocal
OAInvocationInfoStack
private ThreadLocal
clientInvocationInfoStack
private static IOR
codeBaseIOR
private Vector
dynamicRequests
private SynchVariable
svResponseReceived
private Object
runObj
private Object
shutdownObj
private static final byte
STATUS_OPERATING
private static final byte
STATUS_SHUTTING_DOWN
private static final byte
STATUS_SHUTDOWN
private static final byte
STATUS_DESTROYED
private byte
status
private Object
invocationObj
private ThreadLocal
isProcessingInvocation
private Map
typeCodeForClassMap
private Hashtable
valueFactoryCache
private ThreadLocal
orbVersionThreadLocal
private RequestDispatcherRegistry
requestDispatcherRegistry
private CopierManager
copierManager
private int
transientServerId
private ThreadGroup
threadGroup
private ServiceContextRegistry
serviceContextRegistry
private TOAFactory
toaFactory
private POAFactory
poaFactory
private PIHandler
pihandler
private ORBData
configData
private BadServerIdHandler
badServerIdHandler
private ClientDelegateFactory
clientDelegateFactory
private CorbaContactInfoListFactory
corbaContactInfoListFactory
private Object
resolverLock
private Resolver
resolver
private LocalResolver
localResolver
private Operation
urlOperation
private CorbaServerRequestDispatcher
insNamingDelegate
private TaggedComponentFactoryFinder
taggedComponentFactoryFinder
private IdentifiableFactoryFinder
taggedProfileFactoryFinder
private IdentifiableFactoryFinder
taggedProfileTemplateFactoryFinder
private ObjectKeyFactory
objectKeyFactory
private ThreadPoolManager
threadpoolMgr
private Object
badServerIdHandlerAccessLock
The bad server id handler is used by the Locator to send back the location of a persistant server to the client.
private static String
localHostString
private Object
clientDelegateFactoryAccessorLock
private Object
corbaContactInfoListFactoryAccessLock
private Object
objectKeyFactoryAccessLock
private Object
transportManagerAccessorLock
private Object
legacyServerSocketManagerAccessLock
private Object
threadPoolManagerAccessLock
Constructors Summary
public ORBImpl()
Create a new ORB. Should be followed by the appropriate set_parameters() call.

	// All initialization is done through set_parameters().
    
Methods Summary
public voidcheckShutdownState()

        if (status == STATUS_DESTROYED) {
	    throw wrapper.orbDestroyed() ;
        }

        if (status == STATUS_SHUTDOWN) {
	    throw omgWrapper.badOperationAfterShutdown() ;
        }
    
public synchronized voidconnect(org.omg.CORBA.Object servant)
This is the implementation of the public API used to connect a servant-skeleton to the ORB.

        checkShutdownState();
	if (getTOAFactory() == null)
	    throw wrapper.noToa() ;

        try {
	    String codebase = javax.rmi.CORBA.Util.getCodebase( servant.getClass() ) ;
	    getTOAFactory().getTOA( codebase ).connect( servant ) ;
        } catch ( Exception ex ) {
	    throw wrapper.orbConnectError( ex ) ;
        }
    
public com.sun.corba.se.pept.protocol.ClientInvocationInfocreateOrIncrementInvocationInfo()

	StackImpl invocationInfoStack =
	    (StackImpl) clientInvocationInfoStack.get();
	ClientInvocationInfo clientInvocationInfo = null;
	if (!invocationInfoStack.empty()) {
	    clientInvocationInfo =
		(ClientInvocationInfo) invocationInfoStack.peek();
	}
	if ((clientInvocationInfo == null) || 
	    (!clientInvocationInfo.isRetryInvocation()))
	{
	    // This is a new call - not a retry.
	    clientInvocationInfo = new CorbaInvocationInfo(this);
	    startingDispatch();
	    invocationInfoStack.push(clientInvocationInfo);
	}
	// Reset retry so recursive calls will get a new info object.
	clientInvocationInfo.setIsRetryInvocation(false);
	clientInvocationInfo.incrementEntryCount();
	return clientInvocationInfo;
    
public synchronized org.omg.CORBA.TypeCodecreate_abstract_interface_tc(java.lang.String id, java.lang.String name)

        checkShutdownState();
        return new TypeCodeImpl(this, TCKind._tk_abstract_interface, id, name);
    
public synchronized org.omg.CORBA.TypeCodecreate_alias_tc(java.lang.String id, java.lang.String name, org.omg.CORBA.TypeCode original_type)
Create a TypeCode for an alias.

param
id the logical id for the typecode.
param
name the name for the typecode.
param
original_type the type this is an alias for.
return
the requested TypeCode.

        checkShutdownState();
        return new TypeCodeImpl(this, TCKind._tk_alias, id, name, original_type);
    
public synchronized org.omg.CORBA.Anycreate_any()
Create a new Any

return
the new Any created.

        checkShutdownState();
        return new AnyImpl(this);
    
public synchronized org.omg.CORBA.TypeCodecreate_array_tc(int length, org.omg.CORBA.TypeCode element_type)
Create a TypeCode for an array.

param
length the length of the array.
param
element_type the type of elements of the array.
return
the requested TypeCode.

        checkShutdownState();
        return new TypeCodeImpl(this, TCKind._tk_array, length, element_type);
    
public synchronized org.omg.CORBA.ContextListcreate_context_list()
Create a ContextList

result
ContextList created

        checkShutdownState();
        return new ContextListImpl(this);
    
public synchronized org.omg.CORBA.TypeCodecreate_enum_tc(java.lang.String id, java.lang.String name, java.lang.String[] members)
Create a TypeCode for an enum.

param
id the logical id for the typecode.
param
name the name for the typecode.
param
members an array describing the members of the TypeCode.
return
the requested TypeCode.

        checkShutdownState();
        return new TypeCodeImpl(this, TCKind._tk_enum, id, name, members);
    
public synchronized org.omg.CORBA.Environmentcreate_environment()
Create an Environment

result
Environment created

        checkShutdownState();
        return new EnvironmentImpl();
    
public synchronized org.omg.CORBA.ExceptionListcreate_exception_list()
Create an ExceptionList

result
ExceptionList created

        checkShutdownState();
        return new ExceptionListImpl();
    
public synchronized org.omg.CORBA.TypeCodecreate_exception_tc(java.lang.String id, java.lang.String name, org.omg.CORBA.StructMember[] members)
Create a TypeCode for an exception.

param
id the logical id for the typecode.
param
name the name for the typecode.
param
members an array describing the members of the TypeCode.
return
the requested TypeCode.

        checkShutdownState();
        return new TypeCodeImpl(this, TCKind._tk_except, id, name, members);
    
public synchronized org.omg.CORBA.TypeCodecreate_fixed_tc(short digits, short scale)

        checkShutdownState();
        return new TypeCodeImpl(this, TCKind._tk_fixed, digits, scale);
    
public synchronized org.omg.CORBA.TypeCodecreate_interface_tc(java.lang.String id, java.lang.String name)
Create a TypeCode for an interface.

param
id the logical id for the typecode.
param
name the name for the typecode.
return
the requested TypeCode.

        checkShutdownState();
        return new TypeCodeImpl(this, TCKind._tk_objref, id, name);
    
public synchronized org.omg.CORBA.NVListcreate_list(int count)
Create an NVList

param
count size of list to create
result
NVList created
see
NVList

        checkShutdownState();
        return new NVListImpl(this, count);
    
public synchronized org.omg.CORBA.NamedValuecreate_named_value(java.lang.String s, org.omg.CORBA.Any any, int flags)
Create a NamedValue

result
NamedValue created

        checkShutdownState();
        return new NamedValueImpl(this, s, any, flags);
    
public synchronized org.omg.CORBA.TypeCodecreate_native_tc(java.lang.String id, java.lang.String name)

        checkShutdownState();
        return new TypeCodeImpl(this, TCKind._tk_native, id, name);
    
public synchronized org.omg.CORBA.NVListcreate_operation_list(org.omg.CORBA.Object oper)
Create an NVList corresponding to an OperationDef

param
oper operation def to use to create list
result
NVList created
see
NVList

        checkShutdownState();
	throw wrapper.genericNoImpl() ;
    
public synchronized org.omg.CORBA.portable.OutputStreamcreate_output_stream()
The following methods are standard public CORBA ORB APIs

        checkShutdownState();
        return new EncapsOutputStream(this);
    
public synchronized org.omg.CORBA.Policycreate_policy(int type, org.omg.CORBA.Any val)

	checkShutdownState() ;

	return pihandler.create_policy( type, val ) ;
    
public synchronized org.omg.CORBA.TypeCodecreate_recursive_sequence_tc(int bound, int offset)
Create a recursive TypeCode in a sequence.

param
bound the bound for the sequence.
param
offset the index to the enclosing TypeCode that is being referenced.
return
the requested TypeCode.

        checkShutdownState();
        return new TypeCodeImpl(this, TCKind._tk_sequence, bound, offset);
    
public synchronized org.omg.CORBA.TypeCodecreate_recursive_tc(java.lang.String id)

        checkShutdownState();
        return new TypeCodeImpl(this, id);
    
public synchronized org.omg.CORBA.TypeCodecreate_sequence_tc(int bound, org.omg.CORBA.TypeCode element_type)
Create a TypeCode for a sequence.

param
bound the bound for the sequence.
param
element_type the type of elements of the sequence.
return
the requested TypeCode.

        checkShutdownState();
        return new TypeCodeImpl(this, TCKind._tk_sequence, bound, element_type);
    
public synchronized org.omg.CORBA.TypeCodecreate_string_tc(int bound)
Create a TypeCode for a string.

param
bound the bound for the string.
return
the requested TypeCode.

        checkShutdownState();
        return new TypeCodeImpl(this, TCKind._tk_string, bound);
    
public synchronized org.omg.CORBA.TypeCodecreate_struct_tc(java.lang.String id, java.lang.String name, org.omg.CORBA.StructMember[] members)
Create a TypeCode for a structure.

param
id the logical id for the typecode.
param
name the name for the typecode.
param
members an array describing the members of the TypeCode.
return
the requested TypeCode.

        checkShutdownState();
        return new TypeCodeImpl(this, TCKind._tk_struct, id, name, members);
    
public synchronized org.omg.CORBA.TypeCodecreate_union_tc(java.lang.String id, java.lang.String name, org.omg.CORBA.TypeCode discriminator_type, org.omg.CORBA.UnionMember[] members)
Create a TypeCode for a union.

param
id the logical id for the typecode.
param
name the name for the typecode.
param
discriminator_type the type of the union discriminator.
param
members an array describing the members of the TypeCode.
return
the requested TypeCode.

        checkShutdownState();
        return new TypeCodeImpl(this,
                                TCKind._tk_union,
                                id,
                                name,
                                discriminator_type,
                                members);
    
public synchronized org.omg.CORBA.TypeCodecreate_value_box_tc(java.lang.String id, java.lang.String name, org.omg.CORBA.TypeCode boxed_type)

        checkShutdownState();
        return new TypeCodeImpl(this, TCKind._tk_value_box, id, name, 
	    boxed_type);
    
public synchronized org.omg.CORBA.TypeCodecreate_value_tc(java.lang.String id, java.lang.String name, short type_modifier, org.omg.CORBA.TypeCode concrete_base, org.omg.CORBA.ValueMember[] members)

        checkShutdownState();
        return new TypeCodeImpl(this, TCKind._tk_value, id, name,
                                type_modifier, concrete_base, members);
    
public synchronized org.omg.CORBA.TypeCodecreate_wstring_tc(int bound)
Create a TypeCode for a wide string.

param
bound the bound for the string.
return
the requested TypeCode.

        checkShutdownState();
        return new TypeCodeImpl(this, TCKind._tk_wstring, bound);
    
public synchronized voiddestroy()
formal/99-10-07 p 159: "If destroy is called on an ORB that has not been shut down, it will start the shutdown process and block until the ORB has shut down before it destroys the ORB."

	boolean shutdownFirst = false ;

	synchronized (this) {
	    shutdownFirst = (status == STATUS_OPERATING) ;
	}

	if (shutdownFirst) {
            shutdown(true);
        }

        synchronized (this) {
	    if (status < STATUS_DESTROYED) {
		getCorbaTransportManager().close();
		getPIHandler().destroyInterceptors() ;
		status = STATUS_DESTROYED;
	    }
	}

    
public synchronized voiddisconnect(org.omg.CORBA.Object obj)

        checkShutdownState();
	if (getTOAFactory() == null)
	    throw wrapper.noToa() ;

        try {
	    getTOAFactory().getTOA().disconnect( obj ) ;
        } catch ( Exception ex ) {
	    throw wrapper.orbConnectError( ex ) ;
        }
    
private voiddprint(java.lang.String msg)


         
    
        ORBUtility.dprint( this, msg ) ;
    
public voidfinishedDispatch()

        synchronized (invocationObj) {
            isProcessingInvocation.set(Boolean.FALSE);
        }
    
public com.sun.corba.se.spi.protocol.ClientDelegateFactorygetClientDelegateFactory()

	synchronized (clientDelegateFactoryAccessorLock) {
	    return clientDelegateFactory ;
	}
    
public com.sun.corba.se.spi.copyobject.CopierManagergetCopierManager()

	return copierManager ;
    
public synchronized com.sun.corba.se.spi.transport.CorbaContactInfoListFactorygetCorbaContactInfoListFactory()

	return corbaContactInfoListFactory ;
    
public com.sun.corba.se.spi.transport.CorbaTransportManagergetCorbaTransportManager()

	return (CorbaTransportManager) getTransportManager();
    
public synchronized com.sun.corba.se.spi.ior.IORgetFVDCodeBaseIOR()

        if (codeBaseIOR != null) // i.e. We are already connected to it
            return codeBaseIOR;

        // backward compatability 4365188
        CodeBase cb;

        ValueHandler vh = ORBUtility.createValueHandler(this);

        cb = (CodeBase)vh.getRunTimeCodeBase();
	return ORBUtility.connectAndGetIOR( this, cb ) ;
    
private java.lang.StringgetHostName(java.lang.String host)
The following public methods are for ORB shutdown.

        return InetAddress.getByName( host ).getHostAddress();
    
public com.sun.corba.se.pept.protocol.ClientInvocationInfogetInvocationInfo()

	StackImpl invocationInfoStack =
	    (StackImpl) clientInvocationInfoStack.get();
	return (ClientInvocationInfo) invocationInfoStack.peek();
    
public com.sun.corba.se.spi.legacy.connection.LegacyServerSocketManagergetLegacyServerSocketManager()


      
    
	synchronized (legacyServerSocketManagerAccessLock) {
	    if (legacyServerSocketManager == null) {
		legacyServerSocketManager = new LegacyServerSocketManagerImpl(this);
	    }
	    return legacyServerSocketManager;
	}
    
private synchronized java.lang.StringgetLocalHostName()


        
    
        if (localHostString == null) {
            try {
		localHostString = InetAddress.getLocalHost().getHostAddress();
            } catch (Exception ex) {
		throw wrapper.getLocalHostFailed( ex ) ;
            }
	}
	return localHostString ;
    
public com.sun.corba.se.spi.resolver.LocalResolvergetLocalResolver()
Get the LocalResolver used in this ORB. This LocalResolver is used for register_initial_reference only.

	synchronized (resolverLock) {
	    return localResolver ;
	}
    
public com.sun.corba.se.spi.orb.ORBDatagetORBData()

	return configData ;
    
public com.sun.corba.se.spi.orb.ORBVersiongetORBVersion()

        return (ORBVersion)(orbVersionThreadLocal.get()) ;
    
public com.sun.corba.se.spi.ior.ObjectKeyFactorygetObjectKeyFactory()


       
    
	synchronized (objectKeyFactoryAccessLock) {
	    return objectKeyFactory ;
	}
    
public com.sun.corba.se.spi.protocol.PIHandlergetPIHandler()

	return pihandler ;
    
private synchronized com.sun.corba.se.impl.oa.poa.POAFactorygetPOAFactory()

	if (poaFactory == null) {
	    poaFactory = (POAFactory)requestDispatcherRegistry.getObjectAdapterFactory( 
		ORBConstants.TRANSIENT_SCID ) ;
	}

	return poaFactory ;
    
public com.sun.corba.se.spi.protocol.RequestDispatcherRegistrygetRequestDispatcherRegistry()

        return requestDispatcherRegistry;
    
public com.sun.corba.se.spi.resolver.ResolvergetResolver()
Get the resolver used in this ORB. This resolver will be used for list_initial_services and resolve_initial_references.

	synchronized (resolverLock) {
	    return resolver ;
	}
    
public com.sun.corba.se.spi.servicecontext.ServiceContextRegistrygetServiceContextRegistry()

	return serviceContextRegistry ;
    
private synchronized com.sun.corba.se.impl.oa.toa.TOAFactorygetTOAFactory()

	if (toaFactory == null) {
	    toaFactory = (TOAFactory)requestDispatcherRegistry.getObjectAdapterFactory( 
		ORBConstants.TOA_SCID ) ;
	}

	return toaFactory ;
    
public com.sun.corba.se.spi.ior.TaggedComponentFactoryFindergetTaggedComponentFactoryFinder()

	return taggedComponentFactoryFinder ;
    
public com.sun.corba.se.spi.ior.IdentifiableFactoryFindergetTaggedProfileFactoryFinder()

	return taggedProfileFactoryFinder ;
    
public com.sun.corba.se.spi.ior.IdentifiableFactoryFindergetTaggedProfileTemplateFactoryFinder()

	return taggedProfileTemplateFactoryFinder ;
    
public com.sun.corba.se.spi.orbutil.threadpool.ThreadPoolManagergetThreadPoolManager()

	synchronized (threadPoolManagerAccessLock) {
	    if (threadpoolMgr == null) {
		threadpoolMgr = new ThreadPoolManagerImpl( threadGroup );
	    }
	    return threadpoolMgr;
	}
    
public intgetTransientServerId()

        if( configData.getORBServerIdPropertySpecified( ) ) {
            // ORBServerId is specified then use that value
            return configData.getPersistentServerId( );
        }
        return transientServerId;
    
public com.sun.corba.se.pept.transport.TransportManagergetTransportManager()


      
    
	synchronized (transportManagerAccessorLock) {
	    if (transportManager == null) {
		transportManager = new CorbaTransportManagerImpl(this);
	    }
	    return transportManager;
	}
    
public synchronized com.sun.corba.se.impl.corba.TypeCodeImplgetTypeCodeForClass(java.lang.Class c)

        if (typeCodeForClassMap == null)
            return null;
        return (TypeCodeImpl)typeCodeForClassMap.get(c);
    
public com.sun.corba.se.spi.orb.OperationgetURLOperation()
Get the operation used in string_to_object calls. The Operation must expect a String and return an org.omg.CORBA.Object.

	synchronized (resolverLock) {
	    return urlOperation ;
	}
    
public synchronized org.omg.CORBA.Currentget_current()
Get a Current pseudo-object. The Current interface is used to manage thread-specific information for use by the transactions, security and other services. This method is deprecated, and replaced by ORB.resolve_initial_references("NameOfCurrentObject");

return
a Current pseudo-object.
deprecated

        checkShutdownState();

        /* _REVISIT_
           The implementation of get_current is not clear. How would
           ORB know whether the caller wants a Current for transactions
           or security ?? Or is it assumed that there is just one
           implementation for both ? If Current is thread-specific,
           then it should not be instantiated; so where does the
           ORB get a Current ? 
	   
	   This should probably be deprecated. */

	throw wrapper.genericNoImpl() ;
    
public synchronized org.omg.CORBA.Contextget_default_context()
Get the default Context object

result
the default Context object

        checkShutdownState();
	throw wrapper.genericNoImpl() ;
    
public org.omg.CORBA.Requestget_next_response()
Get the next request that has gotten a response.

result
the next request ready with a response.

	synchronized( this ) {
	    checkShutdownState();
	}

        while (true) {
            // check if there already is a response
            synchronized ( dynamicRequests ) {
                Enumeration elems = dynamicRequests.elements();
                while ( elems.hasMoreElements() ) {
                    Request currRequest = (Request)elems.nextElement();
                    if ( currRequest.poll_response() ) {
                        // get the response for this successfully polled Request
                        currRequest.get_response();
                        dynamicRequests.removeElement(currRequest);
                        return currRequest;
                    }
                }
            }

            // wait for a response
            synchronized(this.svResponseReceived) {
                while (!this.svResponseReceived.value()) {
                    try {
                        this.svResponseReceived.wait();
                    } catch(java.lang.InterruptedException ex) {
			// NO-OP
		    }
                }
                // reinitialize the response flag
                this.svResponseReceived.reset();
            }
        }
    
public synchronized org.omg.CORBA.TypeCodeget_primitive_tc(org.omg.CORBA.TCKind tcKind)
Get the TypeCode for a primitive type.

param
tcKind the integer kind for the primitive type
return
the requested TypeCode

        checkShutdownState();
	return get_primitive_tc( tcKind.value() ) ; 
    
public voidhandleBadServerId(com.sun.corba.se.spi.ior.ObjectKey okey)

	synchronized (badServerIdHandlerAccessLock) {
	    if (badServerIdHandler == null)
		throw wrapper.badServerId() ;
	    else 
		badServerIdHandler.handle( okey ) ;
	}
    
public voidinitBadServerIdHandler()


       
    
	synchronized (badServerIdHandlerAccessLock) {
	    Class cls = configData.getBadServerIdHandler() ;
	    if (cls != null) {
		try {
		    Class[] params = new Class[] { org.omg.CORBA.ORB.class };
		    java.lang.Object[] args = new java.lang.Object[]{this};
		    Constructor cons = cls.getConstructor(params);
		    badServerIdHandler = 
			(BadServerIdHandler) cons.newInstance(args);
		} catch (Exception e) {
		    throw wrapper.errorInitBadserveridhandler( e ) ;
		}
	    }
	}
    
public booleanisDuringDispatch()

	Boolean value = (Boolean)(isProcessingInvocation.get()) ;
	return value.booleanValue() ;
    
public booleanisLocalHost(java.lang.String hostName)

	return hostName.equals( configData.getORBServerHost() ) ||
	    hostName.equals( getLocalHostName() ) ;
    
public booleanisLocalServerId(int subcontractId, int serverId)

	if ((subcontractId < ORBConstants.FIRST_POA_SCID) || 
	    (subcontractId > ORBConstants.MAX_POA_SCID))
	    return serverId == getTransientServerId( ) ;
		
	// XXX isTransient info should be stored in subcontract registry
	if (ORBConstants.isTransient( subcontractId ))
	    return (serverId == getTransientServerId()) ;
	else if (configData.getPersistentServerIdInitialized())
	    return (serverId == configData.getPersistentServerId()) ;
	else
	    return false ;
    
public java.lang.String[]list_initial_services()
Get a list of the initially available CORBA services. This does not work unless an ORBInitialHost is specified during initialization (or unless there is an ORB running on the AppletHost) since the localhostname is inaccessible to applets. If a service properties URL was specified, then it is used, otherwise the bootstrapping protocol is used.

return
A list of the initial services available.

	Resolver res ;

	synchronized( this ) {
	    checkShutdownState();
	    res = resolver ;
	}

	synchronized (resolverLock) {
	    java.util.Set keys = res.list() ;
	    return (String[])keys.toArray( new String[keys.size()] ) ;
	}
    
public synchronized org.omg.CORBA.portable.ValueFactorylookup_value_factory(java.lang.String repositoryID)
Finds and returns a value factory for the given repository ID. The value factory returned was previously registered by a call to {@link #register_value_factory} or is the default factory.

param
repositoryID the repository ID.
return
the value factory.
exception
org.omg.CORBA.BAD_PARAM if unable to locate a factory.

        checkShutdownState();

        ValueFactory factory = 
	    (ValueFactory)valueFactoryCache.get(repositoryID);

        if (factory == null) {
            try {
                factory = Utility.getFactory(null, null, null, repositoryID);
            } catch(org.omg.CORBA.MARSHAL ex) {
		throw wrapper.unableFindValueFactory( ex ) ;
            }
        }

	return factory ;
    
public voidnotifyORB()
Notify response to ORB for get_next_response

	synchronized (this.svResponseReceived) {
	    this.svResponseReceived.set();
	    this.svResponseReceived.notify();
	}
    
public synchronized java.lang.Stringobject_to_string(org.omg.CORBA.Object obj)
Convert an object ref to a string.

param
obj The object to stringify.
return
A stringified object reference.

        checkShutdownState();

        // Handle the null objref case
        if (obj == null) {
	    IOR nullIOR = IORFactories.makeIOR( this ) ;
            return nullIOR.stringify();
	}

	IOR ior = null ;

	try {
	    ior = ORBUtility.connectAndGetIOR( this, obj ) ;
	} catch (BAD_PARAM bp) {
	    // Throw MARSHAL instead if this is a LOCAL_OBJECT_NOT_ALLOWED error.
	    if (bp.minor == ORBUtilSystemException.LOCAL_OBJECT_NOT_ALLOWED) {
		throw omgWrapper.notAnObjectImpl( bp ) ;
	    } else
		// Not a local object problem: just rethrow the exception.
		// Do not wrap and log this, since it was already logged at its
		// point of origin.
		throw bp ;
	}

	return ior.stringify() ;
    
public com.sun.corba.se.spi.oa.OAInvocationInfopeekInvocationInfo()

	StackImpl stack = (StackImpl)(OAInvocationInfoStack.get()) ;
	return (OAInvocationInfo)(stack.peek()) ;
    
public synchronized voidperform_work()
This method does nothing. It is not required by the spec to do anything!

        checkShutdownState();
	throw wrapper.genericNoImpl() ;
    
public synchronized booleanpoll_next_response()
Find out if any of the deferred invocations have a response yet.

        checkShutdownState();

        Request currRequest;

        // poll on each pending request
        Enumeration ve = dynamicRequests.elements();
        while (ve.hasMoreElements() == true) {
            currRequest = (Request)ve.nextElement();
            if (currRequest.poll_response() == true) {
                return true;
            }
        }
        return false;
    
public com.sun.corba.se.spi.oa.OAInvocationInfopopInvocationInfo()

	StackImpl stack = (StackImpl)(OAInvocationInfoStack.get()) ;
	return (OAInvocationInfo)(stack.pop()) ;
    
private voidpostInit(java.lang.String[] params, com.sun.corba.se.spi.orb.DataCollector dataCollector)

	// First, create the standard ORB config data.
	// This must be initialized before the ORBConfigurator
	// is executed.
	configData = new ORBDataParserImpl( this, dataCollector) ;

	// Set the debug flags early so they can be used by other
	// parts of the initialization.
	setDebugFlags( configData.getORBDebugFlags() ) ;

	// REVISIT: this should go away after more transport init cleanup
	// and going to ORT based ORBD.  
	getTransportManager();
	getLegacyServerSocketManager();

	// Create a parser to get the configured ORBConfigurator.
	ConfigParser parser = new ConfigParser() ;
	parser.init( dataCollector ) ;

	ORBConfigurator configurator =  null ;
	try {
	    configurator = 
		(ORBConfigurator)(parser.configurator.newInstance()) ;
	} catch (Exception iexc) {
	    throw wrapper.badOrbConfigurator( iexc, parser.configurator.getName() ) ;
	}

	// Finally, run the configurator.  Note that the default implementation allows
	// other configurators with their own parsers to run,
	// using the same DataCollector.
	try {
	    configurator.configure( dataCollector, this ) ;
	} catch (Exception exc) {
	    throw wrapper.orbConfiguratorError( exc ) ;
	}

	// Last of all, create the PIHandler and run the ORB initializers.
	pihandler = new PIHandlerImpl( this, params) ;
	pihandler.initialize() ;

        // Initialize the thread manager pool and byte buffer pool
        // so they may be initialized & accessed without synchronization
        getThreadPoolManager();

        super.getByteBufferPool();
    
private voidpreInit(java.lang.String[] params, java.util.Properties props)
The following methods are ORB initialization

        // Before ORBConfiguration we need to set a PINoOpHandlerImpl,
        // because PersisentServer Initialization inside configurator will
        // invoke orb.resolve_initial_references( ) which will result in a 
        // check on piHandler to invoke Interceptors. We do not want any
        // Interceptors to be invoked before the complete ORB initialization.
        // piHandler will be replaced by a real PIHandler implementation at the
        // end of this method.
	pihandler = new PINoOpHandlerImpl( );

	// See bugs 4916766 and 4936203
	// We intend to create new threads in a reliable thread group.
	// This avoids problems if the application/applet
	// creates a thread group, makes JavaIDL calls which create a new
	// connection and ReaderThread, and then destroys the thread
	// group. If our ReaderThreads were to be part of such destroyed thread
	// group then it might get killed and cause other invoking threads
	// sharing the same connection to get a non-restartable
	// CommunicationFailure. We'd like to avoid that.
	//
	// Our solution is to create all of our threads in the highest thread
	// group that we have access to, given our own security clearance.
	//
        try { 
	    // try to get a thread group that's as high in the threadgroup  
	    // parent-child hierarchy, as we can get to.
	    // this will prevent an ORB thread created during applet-init from 
	    // being killed when an applet dies.
	    threadGroup = (ThreadGroup) AccessController.doPrivileged( 
		new PrivilegedAction() { 
		    public Object run() { 
			ThreadGroup tg = Thread.currentThread().getThreadGroup() ;  
			ThreadGroup ptg = tg ; 
			try { 
			    while (ptg != null) { 
				tg = ptg;  
				ptg = tg.getParent(); 
			    } 
			} catch (SecurityException se) { 
			    // Discontinue going higher on a security exception.
			}
			return new ThreadGroup(tg, "ORB ThreadGroup"); 
		    } 
		}
	    );
	} catch (SecurityException e) { 
	    // something wrong, we go back to the original code 
	    threadGroup = Thread.currentThread().getThreadGroup(); 
	}
 
	// This is the unique id of this server (JVM). Multiple incarnations
	// of this server will get different ids.
	// Compute transientServerId = milliseconds since Jan 1, 1970
	// Note: transientServerId will wrap in about 2^32 / 86400000 = 49.7 days.
	// If two ORBS are started at the same time then there is a possibility
	// of having the same transientServerId. This may result in collision 
	// and may be a problem in ior.isLocal() check to see if the object 
	// belongs to the current ORB. This problem is taken care of by checking
	// to see if the IOR port matches ORB server port in legacyIsLocalServerPort()
	// method.
	//
	// XXX need to move server ID to a string for CORBA 3.0.  At that point,
	// make this more unique (possibly use java.rmi.server.UID).
	transientServerId = (int)System.currentTimeMillis();

	orbVersionThreadLocal  = new ThreadLocal () {
	    protected java.lang.Object initialValue() {
		// set default to version of the ORB with correct Rep-ids
		return ORBVersionFactory.getORBVersion() ;
	    }
	};

	resolverLock = new java.lang.Object() ;

	requestDispatcherRegistry = new RequestDispatcherRegistryImpl( 
	    this, ORBConstants.DEFAULT_SCID);
	copierManager = new CopierManagerImpl( this ) ;

	taggedComponentFactoryFinder = 
	    new TaggedComponentFactoryFinderImpl(this) ;
	taggedProfileFactoryFinder = 
	    new TaggedProfileFactoryFinderImpl(this) ;
	taggedProfileTemplateFactoryFinder = 
	    new TaggedProfileTemplateFactoryFinderImpl(this) ;

	dynamicRequests = new Vector();
	svResponseReceived = new SynchVariable();

	OAInvocationInfoStack = 
	    new ThreadLocal () {
		protected java.lang.Object initialValue() 
		{
		    return new StackImpl();
		} 
	    };

	clientInvocationInfoStack = 
	    new ThreadLocal() {
		protected java.lang.Object initialValue() {
		    return new StackImpl();
		}
	    };

	serviceContextRegistry = new ServiceContextRegistry( this ) ;
    
public voidpushInvocationInfo(com.sun.corba.se.spi.oa.OAInvocationInfo info)

	StackImpl stack = (StackImpl)(OAInvocationInfoStack.get()) ;
	stack.push( info ) ;
    
public voidregister_initial_reference(java.lang.String id, org.omg.CORBA.Object obj)
If this operation is called with an id, "Y", and an object, YY, then a subsequent call to ORB.resolve_initial_references( "Y" ) will return object YY.

param
id The ID by which the initial reference will be known.
param
obj The initial reference itself.
throws
InvalidName if this operation is called with an empty string id or this operation is called with an id that is already registered, including the default names defined by OMG.
throws
BAD_PARAM if the obj parameter is null.

	CorbaServerRequestDispatcher insnd ;

        if ((id == null) || (id.length() == 0))
            throw new InvalidName() ;

	synchronized (this) {
	    checkShutdownState();
	}

	synchronized (resolverLock) {
	    insnd = insNamingDelegate ;

	    java.lang.Object obj2 = localResolver.resolve( id ) ;
	    if (obj2 != null)
		throw new InvalidName(id + " already registered") ;

	    localResolver.register( id, ClosureFactory.makeConstant( obj )) ;
	}
      
	synchronized (this) {
	    if (StubAdapter.isStub(obj))
		// Make all remote object references available for INS.
		requestDispatcherRegistry.registerServerRequestDispatcher( 
		    insnd, id ) ;
	}
    
public synchronized org.omg.CORBA.portable.ValueFactoryregister_value_factory(java.lang.String repositoryID, org.omg.CORBA.portable.ValueFactory factory)
Registers a value factory for a particular repository ID.

param
repositoryID the repository ID.
param
factory the factory.
return
the previously registered factory for the given repository ID, or null if no such factory was previously registered.
exception
org.omg.CORBA.BAD_PARAM if the registration fails.

        checkShutdownState();

        if ((repositoryID == null) || (factory == null))
	    throw omgWrapper.unableRegisterValueFactory() ;

        return (ValueFactory)valueFactoryCache.put(repositoryID, factory);
    
public voidreleaseOrDecrementInvocationInfo()

	StackImpl invocationInfoStack =
	    (StackImpl)clientInvocationInfoStack.get();
	ClientInvocationInfo clientInvocationInfo = null;
	if (!invocationInfoStack.empty()) {
	    clientInvocationInfo =
		(ClientInvocationInfo)invocationInfoStack.peek();
	} else {
	    throw wrapper.invocationInfoStackEmpty() ;
	}
	clientInvocationInfo.decrementEntryCount();
	if (clientInvocationInfo.getEntryCount() == 0) {
	    invocationInfoStack.pop();
	    finishedDispatch();
	}
    
public org.omg.CORBA.Objectresolve_initial_references(java.lang.String identifier)
Resolve the stringified reference of one of the initially available CORBA services.

param
identifier The stringified object reference of the desired service.
return
An object reference for the desired service.
exception
InvalidName The supplied identifier is not associated with a known service.
exception
SystemException One of a fixed set of Corba system exceptions.

	Resolver res ;

	synchronized( this ) {
	    checkShutdownState();
	    res = resolver ;
	}

	synchronized (resolverLock) {
	    org.omg.CORBA.Object result = res.resolve( identifier ) ;

	    if (result == null)
		throw new InvalidName() ;
	    else
		return result ;
	}
    
public voidrun()
The following methods (introduced in POA / CORBA2.1) deal with shutdown / single threading.

	synchronized (this) {
	    checkShutdownState();
	}

        synchronized (runObj) {
            try {
                runObj.wait();
            } catch ( InterruptedException ex ) {}
        }
    
public synchronized voidsend_multiple_requests_deferred(org.omg.CORBA.Request[] req)
Send multiple dynamic requests asynchronously.

param
req an array of request objects.

        checkShutdownState();

        // add the new Requests to pending dynamic Requests
        for (int i = 0; i < req.length; i++) {
            dynamicRequests.addElement(req[i]);
        }

        // Invoke the send_deferred on each new Request
        for (int i = 0; i < req.length; i++) {
            AsynchInvoke invokeObject = new AsynchInvoke( this, 
		(com.sun.corba.se.impl.corba.RequestImpl)req[i], true);
            new Thread(invokeObject).start();
        }
    
public synchronized voidsend_multiple_requests_oneway(org.omg.CORBA.Request[] req)

        checkShutdownState();

        // Invoke the send_oneway on each new Request
        for (int i = 0; i < req.length; i++) {
            req[i].send_oneway();
        }
    
public voidsetBadServerIdHandler(com.sun.corba.se.impl.oa.poa.BadServerIdHandler handler)

	synchronized (badServerIdHandlerAccessLock) {
	    badServerIdHandler = handler;
	}
    
public voidsetClientDelegateFactory(com.sun.corba.se.spi.protocol.ClientDelegateFactory factory)


          
    
	synchronized (clientDelegateFactoryAccessorLock) {
	    clientDelegateFactory = factory ;
	}
    
public voidsetCorbaContactInfoListFactory(com.sun.corba.se.spi.transport.CorbaContactInfoListFactory factory)


          
    
	synchronized (corbaContactInfoListFactoryAccessLock) {
	    corbaContactInfoListFactory = factory ;
	}
    
protected voidsetDebugFlags(java.lang.String[] args)

	for (int ctr=0; ctr<args.length; ctr++ ) {
            String token = args[ctr] ;

            // If there is a public boolean data member in this class
            // named token + "DebugFlag", set it to true.
            try {
                Field fld = this.getClass().getField( token + "DebugFlag" ) ;
                int mod = fld.getModifiers() ;
                if (Modifier.isPublic( mod ) && !Modifier.isStatic( mod ))
                    if (fld.getType() == boolean.class)
                        fld.setBoolean( this, true ) ;
            } catch (Exception exc) {
                // ignore it XXX log this as info
            }
        }
    
public voidsetINSDelegate(com.sun.corba.se.spi.protocol.CorbaServerRequestDispatcher sdel)

	synchronized (resolverLock) {
	    insNamingDelegate = sdel ;
	}
    
public voidsetLocalResolver(com.sun.corba.se.spi.resolver.LocalResolver resolver)
Set the LocalResolver used in this ORB. This LocalResolver is used for register_initial_reference only.

	synchronized (resolverLock) {
	    this.localResolver = resolver ;
	}
    
public voidsetORBVersion(com.sun.corba.se.spi.orb.ORBVersion verObj)

        orbVersionThreadLocal.set(verObj);
    
public voidsetObjectKeyFactory(com.sun.corba.se.spi.ior.ObjectKeyFactory factory)

	synchronized (objectKeyFactoryAccessLock) {
	    objectKeyFactory = factory ;
	}
    
public voidsetResolver(com.sun.corba.se.spi.resolver.Resolver resolver)
Set the resolver used in this ORB. This resolver will be used for list_initial_services and resolve_initial_references.

	synchronized (resolverLock) {
	    this.resolver = resolver ;
	}
    
public voidsetThreadPoolManager(com.sun.corba.se.spi.orbutil.threadpool.ThreadPoolManager mgr)


        
    
	synchronized (threadPoolManagerAccessLock) {
	    threadpoolMgr = mgr;
	}
    
public synchronized voidsetTypeCodeForClass(java.lang.Class c, com.sun.corba.se.impl.corba.TypeCodeImpl tci)

        if (typeCodeForClassMap == null)
            typeCodeForClassMap = Collections.synchronizedMap(
		new WeakHashMap(64));
        // Store only one TypeCode per class.
        if ( ! typeCodeForClassMap.containsKey(c))
            typeCodeForClassMap.put(c, tci);
    
public voidsetURLOperation(com.sun.corba.se.spi.orb.Operation stringToObject)
Set the operation used in string_to_object calls. The Operation must expect a String and return an org.omg.CORBA.Object.

	synchronized (resolverLock) {
	    urlOperation = stringToObject ;
	}
    
public synchronized voidset_delegate(java.lang.Object servant)

        checkShutdownState();

	POAFactory poaFactory = getPOAFactory() ;
	if (poaFactory != null)
	    ((org.omg.PortableServer.Servant)servant)
		._set_delegate( poaFactory.getDelegateImpl() ) ;
	else
	    throw wrapper.noPoa() ;
    
public voidset_parameters(java.util.Properties props)

	preInit( null, props ) ;
	DataCollector dataCollector = 
	    DataCollectorFactory.create( props, getLocalHostName() ) ;
	postInit( null, dataCollector ) ;
    
protected voidset_parameters(java.applet.Applet app, java.util.Properties props)

	preInit( null, props ) ;
	DataCollector dataCollector = 
	    DataCollectorFactory.create( app, props, getLocalHostName() ) ;
	postInit( null, dataCollector ) ;
    
protected voidset_parameters(java.lang.String[] params, java.util.Properties props)

	preInit( params, props ) ;
	DataCollector dataCollector = 
	    DataCollectorFactory.create( params, props, getLocalHostName() ) ;
	postInit( params, dataCollector ) ;
    
public voidshutdown(boolean wait_for_completion)

        // to wait for completion, we would deadlock, so throw a standard
        // OMG exception.
        if (wait_for_completion && ((Boolean)isProcessingInvocation.get()).booleanValue()) {
	    throw omgWrapper.shutdownWaitForCompletionDeadlock() ;
        }

        boolean doShutdown = false ;

        synchronized (this) {
	    checkShutdownState() ;

	    if (status == STATUS_SHUTTING_DOWN) {
	        if (!wait_for_completion)
		// If we are already shutting down and don't want
		// to wait, nothing to do: return.
		return ;
	    } else {
	        // The ORB status was STATUS_OPERATING, so start the shutdown.
	        status = STATUS_SHUTTING_DOWN ;
	        doShutdown = true ;
	    }
        }
	
        // At this point, status is SHUTTING_DOWN.
        // All shutdown calls with wait_for_completion == true must synchronize
        // here.  Only the first call will be made with doShutdown == true.
        synchronized (shutdownObj) {
	    if (doShutdown) {
	        // shutdownServants will set all POAManagers into the
	        // INACTIVE state, causing request to be rejected.
	        // If wait_for_completion is true, this will not return until
	        // all invocations have completed.
	        shutdownServants(wait_for_completion);
    
	        synchronized (runObj) {
		    runObj.notifyAll();
	        }
	    	
	        synchronized (this) {
		    status = STATUS_SHUTDOWN;
	        }
	    }
        }
    
protected voidshutdownServants(boolean wait_for_completion)
This method shuts down the ORB and causes orb.run() to return. It will cause all POAManagers to be deactivated, which in turn will cause all POAs to be deactivated.

	Iterator iter = requestDispatcherRegistry.getObjectAdapterFactories().iterator() ;
	while (iter.hasNext()) {
	    ObjectAdapterFactory oaf = (ObjectAdapterFactory)iter.next() ;
	    oaf.shutdown( wait_for_completion ) ;
	}
    
public voidstartingDispatch()

        synchronized (invocationObj) {
            isProcessingInvocation.set(Boolean.TRUE);
        }
    
public org.omg.CORBA.Objectstring_to_object(java.lang.String str)
Convert a stringified object reference to the object it represents.

param
str The stringified object reference.
return
The unstringified object reference.

	Operation op ;

	synchronized (this) {
	    checkShutdownState();
	    op = urlOperation ;
	}

	if (str == null)
	    throw wrapper.nullParam() ;

	synchronized (resolverLock) {
	    org.omg.CORBA.Object obj = (org.omg.CORBA.Object)op.operate( str ) ;
	    return obj ;
	}
    
public synchronized voidunregister_value_factory(java.lang.String repositoryID)
Unregisters a value factory for a particular repository ID.

param
repositoryID the repository ID.

        checkShutdownState();

        if (valueFactoryCache.remove(repositoryID) == null)
	    throw wrapper.nullParam() ;
    
public synchronized booleanwork_pending()
This method always returns false because the ORB never needs the main thread to do work.

        checkShutdownState();
	throw wrapper.genericNoImpl() ;