orb.java

来自「java jdk 1.4的源码」· Java 代码 · 共 1,939 行 · 第 1/5 页

JAVA
1,939
字号
                    throw new INITIALIZE(ORBConstants.GIOP_TARGET_ADDRESSING +                        " Illegal value : " + param);                }                if (ORBInitDebug) {                    dprint("setting GIOP TargetAddressing to " +                        giopTargetAddressPreference);                }            } catch (java.lang.NumberFormatException e) {                if (ORBInitDebug)                    dprint( "Error: " + e);                throw new INITIALIZE(ORBConstants.GIOP_TARGET_ADDRESSING +                    " Illegal value : " + param);                                }                  }        // Code set related        param = props.getProperty(ORBConstants.ALWAYS_SEND_CODESET_CTX_PROPERTY);        if (param != null) {            alwaysSendCodeSetCtx = Boolean.valueOf(param).booleanValue();            if (ORBInitDebug)                dprint("Setting alwaysSendCodeSetCtx to " + alwaysSendCodeSetCtx);        }        param = props.getProperty(ORBConstants.USE_BOMS);        if (param != null) {            useByteOrderMarkers = Boolean.valueOf(param).booleanValue();            if (ORBInitDebug)                dprint("Setting useByteOrderMarkers to " + useByteOrderMarkers);        }        param = props.getProperty(ORBConstants.USE_BOMS_IN_ENCAPS);        if (param != null) {            useByteOrderMarkersInEncaps = Boolean.valueOf(param).booleanValue();            if (ORBInitDebug)                dprint("Setting useByteOrderMarkersInEncaps to " + useByteOrderMarkersInEncaps);        }        CodeSetComponentInfo.CodeSetComponent charData            = CodeSetComponentInfo.JAVASOFT_DEFAULT_CODESETS.getCharComponent();        param = props.getProperty(ORBConstants.CHAR_CODESETS);        if (param != null) {            charData = CodeSetComponentInfo.createFromString(param);            if (ORBInitDebug)                dprint("charData: " + charData);        }        CodeSetComponentInfo.CodeSetComponent wcharData            = CodeSetComponentInfo.JAVASOFT_DEFAULT_CODESETS.getWCharComponent();        param = props.getProperty(ORBConstants.WCHAR_CODESETS);        if (param != null) {            wcharData = CodeSetComponentInfo.createFromString(param);            if (ORBInitDebug)                dprint("wcharData: " + wcharData);        }        codesets = new CodeSetComponentInfo(charData, wcharData);	param = props.getProperty( ORBConstants.ALLOW_LOCAL_OPTIMIZATION ) ;	if (param != null) {	    allowLocalOptimization = true ;	}        //...//        param = props.getProperty( ORBConstants.SOCKET_FACTORY_CLASS_PROPERTY ) ;        if (param != null) {            try {                Class socketFactoryClass = ORBClassLoader.loadClass(param);                // For security reasons avoid creating an instance if		// this socket factory class is not one that would fail		// the class cast anyway.                if (ORBSocketFactory.class.isAssignableFrom(socketFactoryClass)) {		    socketFactory = (ORBSocketFactory)socketFactoryClass.newInstance();		    if (ORBInitDebug) {			dprint("setting socketFactory to: " + socketFactory);		    }                } else {                    // throw some exception just to get into the outer catch clause                    throw new ClassCastException();                }            } catch (Exception ex) {                // ClassNotFoundException, IllegalAccessException, InstantiationException,                // SecurityException or ClassCastException                throw new INITIALIZE(		    "can't instantiate custom socket factory: " + param);            }        } else {            socketFactory = new DefaultSocketFactory();        } 	// 	// ORBListenSocket 	// 	param = props.getProperty(ORBConstants.LISTEN_SOCKET_PROPERTY); 	if (param != null) { 	    StringTokenizer pairs = 		new StringTokenizer(param, ","); 	    while (pairs.hasMoreTokens()) { 		String current = pairs.nextToken(); 		StringTokenizer pair = new StringTokenizer(current, ":"); 		String type = null; 		int port = -1; 		if  (pair.hasMoreTokens()) { 		    type = pair.nextToken(); 		    if (pair.hasMoreTokens()) { 			try { 			    port = Integer.parseInt(pair.nextToken()); 			} catch (NumberFormatException e) { 			    ; 			} 		    } 		} 		if (type == null || port == -1) { 		    throw new INITIALIZE("Improper ORBListenSocket format: " 					 + param); 		} 		userSpecifiedListenPorts.add(new UserSpecifiedListenPort(type, port)); 	    }	    if (ORBInitDebug) {		dprint("setting listen sockets: " + param);	    }	}    }/**************************************************************************** * The following methods are getters and setters for ORB variables. ****************************************************************************/    /**      * Get the name of the host running the initial services nameserver.     * @return The name of the ORBInitialHost.     */    public String getORBInitialHost()    {        return ORBInitialHost;    }    /**      * Get the port of the initial services nameserver.     */    public int getORBInitialPort()    {        return ORBInitialPort;    }    public String getORBServerHost() {        return ORBServerHost;    }    public int getORBServerPort() {        return ORBServerPort;    }    /**      * Get the name of the host from which this applet was downloaded.     * @return The name of the AppletHost.     */    public String getAppletHost()    {        return appletHost;    }    /**      * Get the codebase from which this applet was downloaded.     */    public URL getAppletCodeBase()    {        return appletCodeBase;    }    public class UserSpecifiedListenPort    {	private String type;	private int    port;	UserSpecifiedListenPort (String type, int port)	{	    this.type = type;	    this.port = port;	}	public String getType  () { return type; }	public int    getPort  () { return port; }	public String toString () { return type + ":" + port; }    }    /**     * Get the user-defined listen port types.     */    public Collection getUserSpecifiedListenPorts ()    {	return userSpecifiedListenPorts;    }    /**     * Get the socket factory for this ORB.     */    public ORBSocketFactory getSocketFactory ()    {        return socketFactory;    }    /**     * Get high water mark number beyond which      * ORB will not create any more new connections.     */    public int getHighWaterMark(){        return highWaterMark;    }    /**     * Get low water mark number above which      * ORB will start connection cleanup.     */    public int getLowWaterMark(){        return lowWaterMark;    }    /**     * Get number to reclaim which the     * ORB uses to determine how many connections to      * try to clean up.     */    public int getNumberToReclaim(){        return numberToReclaim;    }    /**     * GIOP Related Constants.     */    public GIOPVersion getGIOPVersion() {        return giopVersion;    }    public int getGIOPFragmentSize() {         return giopFragmentSize;    }    public int getGIOPBufferSize() {        return giopBufferSize;    }    public int getGIOPBuffMgrStrategy(GIOPVersion gv) {        if(gv!=null){            if (gv.equals(GIOPVersion.V1_0)) return 0; //Always grow for 1.0            if (gv.equals(GIOPVersion.V1_1)) return giop11BuffMgr;            if (gv.equals(GIOPVersion.V1_2)) return giop12BuffMgr;        }        //If a "faulty" GIOPVersion is passed, it's going to return 0;        return 0;     }    /**     * @return the GIOP Target Addressing preference of the ORB.     * This ORB by default supports all addressing dispositions unless specified     * otherwise via a java system property ORBConstants.GIOP_TARGET_ADDRESSING     */    public short getGIOPTargetAddressPreference() {        return giopTargetAddressPreference;    }            /**     * The default addressing disposition is KeyAddr.value     */    public short getGIOPAddressDisposition() {        return giopAddressDisposition;        }        public org.omg.CORBA.portable.OutputStream create_output_stream()    {        checkShutdownState();        return new EncapsOutputStream(this);    }    /**     * 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     */    public org.omg.CORBA.Current get_current()    {        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 ? */        throw new NO_IMPLEMENT();    }    /*     **************************************************************************     *  The following methods are hooks for Portable Interceptors.     *  They have empty method bodies so that we may ship with or without     *  PI support.  The actual implementations can be found in      *  Interceptors.PIORB.  Note that not all of these are used in this     *  package, but this ORB class serves as a common place for javadoc     *  comments and to enumerate all hooks.     *************************************************************************/    /*     *****************     * Client PI hooks     *****************/        /**     * Called for pseudo-ops to temporarily disable portable interceptor     * hooks for calls on this thread.  Keeps track of the number of     * times this is called and increments the disabledCount.     */    protected void disableInterceptorsThisThread() {        // Intentionally left empty.  See above note.    }        /**     * Called for pseudo-ops to re-enable portable interceptor     * hooks for calls on this thread.  Decrements the disabledCount.     * If disabledCount is 0, interceptors are re-enabled.     */    protected void enableInterceptorsThisThread() {        // Intentionally left empty.  See above note.    }        /**     * Called when the send_request or send_poll portable interception point      * is to be invoked for all appropriate client-side request interceptors.     *     * @exception RemarhsalException - Thrown when this request needs to     *     be retried.     */    protected void invokeClientPIStartingPoint()         throws RemarshalException     {        // Intentionally left empty.  See above note.    }        /**     * Called when the appropriate client ending interception point is     * to be invoked for all apporpriate client-side request interceptors.     *     * @param replyStatus One of the constants in iiop.messages.ReplyMessage     *     indicating which reply status to set.     * @param exception The exception before ending interception points have     *     been invoked, or null if no exception at the moment.     * @return The exception to be thrown, after having gone through     *     all ending points, or null if there is no exception to be     *     thrown.  Note that this exception can be either the same or     *     different from the exception set using setClientPIException.     *     There are four possible return types: null (no exception),      *     SystemException, UserException, or RemarshalException.     */    protected Exception invokeClientPIEndingPoint(        int replyStatus, Exception exception )    {        // Defualt implementation is just a simple pass-through of the        // given exception.        return exception;    }        /**     * Invoked when a request is about to be created.  Must be called before     * any of the setClientPI* methods so that a new info object can be     * prepared for information collection.     *     * @param diiRequest True if this is to be a DII request, or false if it     *     is a "normal" request.  In the DII case, initiateClientPIRequest     *     is called twice and we need to ignore the second one.     */    protected void initiateClientPIRequest( boolean diiRequest ) {        // Intentionally left empty.  See above note.    }        /**     * Invoked when a request is about to be cleaned up.  Must be called     * after ending points are called so that the info object on the stack     * can be deinitialized and popped from the stack at the appropriate     * time.     */    protected void cleanupClientPIRequest() {        // Intentionally left empty.  See above note.    }        /**

⌨️ 快捷键说明

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