⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 orbimpl.java

📁 JAVA 所有包
💻 JAVA
📖 第 1 页 / 共 4 页
字号:
	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 void setBadServerIdHandler( BadServerIdHandler handler )     {	synchronized (badServerIdHandlerAccessLock) {	    badServerIdHandler = handler;	}    }    public void handleBadServerId( ObjectKey okey )     {	synchronized (badServerIdHandlerAccessLock) {	    if (badServerIdHandler == null)		throw wrapper.badServerId() ;	    else 		badServerIdHandler.handle( okey ) ;	}    }    public synchronized org.omg.CORBA.Policy create_policy( int type, 	org.omg.CORBA.Any val ) throws org.omg.CORBA.PolicyError    {	checkShutdownState() ;	return pihandler.create_policy( type, val ) ;    }    /** This is the implementation of the public API used to connect     *  a servant-skeleton to the ORB.     */    public synchronized void connect(org.omg.CORBA.Object servant)    {        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 synchronized void disconnect(org.omg.CORBA.Object obj)    {        checkShutdownState();	if (getTOAFactory() == null)	    throw wrapper.noToa() ;        try {	    getTOAFactory().getTOA().disconnect( obj ) ;        } catch ( Exception ex ) {	    throw wrapper.orbConnectError( ex ) ;        }    }    public int getTransientServerId()    {        if( configData.getORBServerIdPropertySpecified( ) ) {            // ORBServerId is specified then use that value            return configData.getPersistentServerId( );        }        return transientServerId;    }    public RequestDispatcherRegistry getRequestDispatcherRegistry()    {        return requestDispatcherRegistry;    }    public ServiceContextRegistry getServiceContextRegistry()    {	return serviceContextRegistry ;    }     // XXX All of the isLocalXXX checking needs to be revisited.    // First of all, all three of these methods are called from    // only one place in impl.ior.IORImpl.  Second, we have problems    // both with multi-homed hosts and with multi-profile IORs.    // A possible strategy: like the LocalClientRequestDispatcher, we need    // to determine this more abstractly at the ContactInfo level.    // This level should probably just get the CorbaContactInfoList from    // the IOR, then iterator over ContactInfo.  If any ContactInfo is    // local, the IOR is local, and we can pick one to create the     // LocalClientRequestDispatcher as well.  Bottom line: this code needs to move.    // XXX What about multi-homed host?    public boolean isLocalHost( String hostName )     {	return hostName.equals( configData.getORBServerHost() ) ||	    hostName.equals( getLocalHostName() ) ;    }    public boolean isLocalServerId( 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 ;    }    /*************************************************************************     *  The following public methods are for ORB shutdown.     *************************************************************************/    private String getHostName(String host) 	throws java.net.UnknownHostException     {        return InetAddress.getByName( host ).getHostAddress();    }    /* keeping a copy of the getLocalHostName so that it can only be called      * internally and the unauthorized clients cannot have access to the     * localHost information, originally, the above code was calling      * getLocalHostName from Connection.java.  If the hostname is cached in      * Connection.java, then     * it is a security hole, since any unauthorized client has access to     * the host information.  With this change it is used internally so the     * security problem is resolved.  Also in Connection.java, the      * getLocalHost() implementation has changed to always call the      * InetAddress.getLocalHost().getHostAddress()     * The above mentioned method has been removed from the connection class     */    private static String localHostString = null;    private synchronized String getLocalHostName()     {        if (localHostString == null) {            try {		localHostString = InetAddress.getLocalHost().getHostAddress();            } catch (Exception ex) {		throw wrapper.getLocalHostFailed( ex ) ;            }	}	return localHostString ;    } /****************************************************************************** *  The following public methods are for ORB shutdown.  * ******************************************************************************/    /** This method always returns false because the ORB never needs the     *  main thread to do work.     */    public synchronized boolean work_pending()    {        checkShutdownState();	throw wrapper.genericNoImpl() ;    }      /** This method does nothing. It is not required by the spec to do anything!     */    public synchronized void perform_work()    {        checkShutdownState();	throw wrapper.genericNoImpl() ;    }    public synchronized void set_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() ;    }    ////////////////////////////////////////////////////    //    // pept.broker.Broker    //    public ClientInvocationInfo createOrIncrementInvocationInfo()     {	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 void releaseOrDecrementInvocationInfo()     {	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 ClientInvocationInfo getInvocationInfo()     {	StackImpl invocationInfoStack =	    (StackImpl) clientInvocationInfoStack.get();	return (ClientInvocationInfo) invocationInfoStack.peek();    }    ////////////////////////////////////////////////////    //    //    //    private Object clientDelegateFactoryAccessorLock = new Object();    public void setClientDelegateFactory( ClientDelegateFactory factory )     {	synchronized (clientDelegateFactoryAccessorLock) {	    clientDelegateFactory = factory ;	}    }    public ClientDelegateFactory getClientDelegateFactory()     {	synchronized (clientDelegateFactoryAccessorLock) {	    return clientDelegateFactory ;	}    }    private Object corbaContactInfoListFactoryAccessLock = new Object();    public void setCorbaContactInfoListFactory( CorbaContactInfoListFactory factory )     {	synchronized (corbaContactInfoListFactoryAccessLock) {	    corbaContactInfoListFactory = factory ;	}    }    public synchronized CorbaContactInfoListFactory getCorbaContactInfoListFactory()     {	return corbaContactInfoListFactory ;    }    /** Set the resolver used in this ORB.  This resolver will be used for list_initial_services     * and resolve_initial_references.     */    public void setResolver( Resolver resolver )     {	synchronized (resolverLock) {	    this.resolver = resolver ;	}    }    /** Get the resolver used in this ORB.  This resolver will be used for list_initial_services     * and resolve_initial_references.     */    public Resolver getResolver()     {	synchronized (resolverLock) {	    return resolver ;	}    }    /** Set the LocalResolver used in this ORB.  This LocalResolver is used for      * register_initial_reference only.     */    public void setLocalResolver( LocalResolver resolver )     {	synchronized (resolverLock) {	    this.localResolver = resolver ;	}    }    /** Get the LocalResolver used in this ORB.  This LocalResolver is used for      * register_initial_reference only.     */    public LocalResolver getLocalResolver()     {	synchronized (resolverLock) {	    return localResolver ;	}    }    /** Set the operation used in string_to_object calls.  The Operation must expect a     * String and return an org.omg.CORBA.Object.     */    public void setURLOperation( Operation stringToObject )     {	synchronized (resolverLock) {	    urlOperation = stringToObject ;	}    }    /** Get the operation used in string_to_object calls.  The Operation must expect a     * String and return an org.omg.CORBA.Object.     */    public Operation getURLOperation()     {	synchronized (resolverLock) {	    return urlOperation ;	}    }    public void setINSDelegate( CorbaServerRequestDispatcher sdel )    {	synchronized (resolverLock) {	    insNamingDelegate = sdel ;	}    }    public TaggedComponentFactoryFinder getTaggedComponentFactoryFinder()     {	return taggedComponentFactoryFinder ;    }    public IdentifiableFactoryFinder getTaggedProfileFactoryFinder()     {	return taggedProfileFactoryFinder ;    }    public IdentifiableFactoryFinder getTaggedProfileTemplateFactoryFinder()     {	return taggedProfileTemplateFactoryFinder ;    }    private Object objectKeyFactoryAccessLock = new Object();    public ObjectKeyFactory getObjectKeyFactory()     {	synchronized (objectKeyFactoryAccessLock) {	    return objectKeyFactory ;	}    }    public void setObjectKeyFactory( ObjectKeyFactory factory )     {	synchronized (objectKeyFactoryAccessLock) {	    objectKeyFactory = factory ;	}    }    private Object transportManagerAccessorLock = new Object();    public TransportManager getTransportManager()    {	synchronized (transportManagerAccessorLock) {	    if (transportManager == null) {		transportManager = new CorbaTransportManagerImpl(this);	    }	    return transportManager;	}    }    public CorbaTransportManager getCorbaTransportManager()    {	return (CorbaTransportManager) getTransportManager();    }    private Object legacyServerSocketManagerAccessLock = new Object();    public LegacyServerSocketManager getLegacyServerSocketManager()    {	synchronized (legacyServerSocketManagerAccessLock) {	    if (legacyServerSocketManager == null) {		legacyServerSocketManager = new LegacyServerSocketManagerImpl(this);	    }	    return legacyServerSocketManager;	}    }    private Object threadPoolManagerAccessLock = new Object();    public void setThreadPoolManager(ThreadPoolManager mgr)     {	synchronized (threadPoolManagerAccessLock) {	    threadpoolMgr = mgr;	}    }    public ThreadPoolManager getThreadPoolManager()     {	synchronized (threadPoolManagerAccessLock) {	    if (threadpoolMgr == null) {		threadpoolMgr = new ThreadPoolManagerImpl( threadGroup );	    }	    return threadpoolMgr;	}    }    public CopierManager getCopierManager()    {	return copierManager ;    }} // Class ORBImpl/////////////////////////////////////////////////////////////////////////// Helper class for a Synchronization Variable////////////////////////////////////////////////////////////////////////class SynchVariable {    // Synchronization Variable    public boolean _flag;    // Constructor    SynchVariable()     {        _flag = false;    }    // set Flag to true    public void set()     {        _flag = true;    }        // get value    public boolean value()     {        return _flag;    }    // reset Flag to true    public void reset()     {        _flag = false;    }}// End of file.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -