clientrequestinfoimpl.java

来自「java jdk 1.4的源码」· Java 代码 · 共 977 行 · 第 1/3 页

JAVA
977
字号
		    index++;		}	    }	    cachedOperationContext = context;	}        // Good citizen: In the interest of efficiency, we assume         // interceptors will be "good citizens" in that they will not         // modify the contents of the String[] array.  	return cachedOperationContext;    }    /**     * See RequestInfoImpl for javadoc.     */    public Any result (){        checkAccess( MID_RESULT );	if( cachedResult == null ) {	    if( request == null ) {		throw new NO_RESOURCES(		    "The Portable Java Bindings do not support result()",		    MinorCodes.PI_OPERATION_NOT_SUPPORTED,		    CompletionStatus.COMPLETED_NO );	    }	    // Get the result from the DII request data.	    NamedValue nvResult = request.result( );	    if( nvResult == null ) {		throw new INTERNAL(		    "DII nvResult should not be null.",		    MinorCodes.PI_DII_RESULT_IS_NULL,		    CompletionStatus.COMPLETED_NO );	    }	    cachedResult = nvResult.value();	}	// Good citizen: In the interest of efficiency, we assume that	// interceptors will not modify the contents of the result Any.	// Otherwise, we would need to create a deep copy of the Any.        return cachedResult;    }    /**     * See RequestInfoImpl for javadoc.     */    public boolean response_expected (){	// access is currently valid for all states:	//checkAccess( MID_RESPONSE_EXPECTED );	return !isOneWay;    }    /**     * See RequestInfoImpl for javadoc.     */    public Object forward_reference (){        checkAccess( MID_FORWARD_REFERENCE );        // Check to make sure we are in LOCATION_FORWARD        // state as per ptc/00-08-06, table 21-1        // footnote 2.        if( replyStatus != LOCATION_FORWARD.value ) {            throw new BAD_INV_ORDER(                "Invalid to query forward_reference() when reply status " +                "is not LOCATION_FORWARD.",                MinorCodes.INVALID_PI_CALL, CompletionStatus.COMPLETED_NO );        }	// Do not cache this value since if an interceptor raises	// forward request then the next interceptor in the	// list should see the new value.	IOR ior = clientDelegate.getLocatedIOR();	return iorToObject(ior);    }    /**     * See RequestInfoImpl for javadoc.     */    public org.omg.IOP.ServiceContext get_request_service_context( int id ) {        checkAccess( MID_GET_REQUEST_SERVICE_CONTEXT );	if( cachedRequestServiceContexts == null ) {	    cachedRequestServiceContexts = new HashMap();	}        return getServiceContext( cachedRequestServiceContexts, 				  serviceContexts, id );    }    /**     * does not contain an etry for that ID, BAD_PARAM with a minor code of     * TBD_BP is raised.     */    public org.omg.IOP.ServiceContext get_reply_service_context( int id ) {        checkAccess( MID_GET_REPLY_SERVICE_CONTEXT );       	// In the event this is called from a oneway, we will have no	// response object.	//	// In the event this is called after a IIOPConnection.purge_calls,	// we will have a response object, but that object will	// not contain a header (which would hold the service context	// container).  See bug 4624102.	//	// REVISIT: this is the only thing used	// from response at this time.  However, a more general solution	// would avoid accessing other parts of response's header.	//	// Instead of throwing a NullPointer, we will	// "gracefully" handle these with a BAD_PARAM with minor code 25.	if( response == null ||	    response.getServiceContexts() == null )	{                     	    throw new BAD_PARAM( "No such service context " +				 "(note: inaccessible from oneway calls)",				 MinorCodes.INVALID_SERVICE_CONTEXT_ID,				 CompletionStatus.COMPLETED_NO );	}	if( cachedReplyServiceContexts == null ) {	    cachedReplyServiceContexts = new HashMap();	}        return getServiceContext( cachedReplyServiceContexts,				  response.getServiceContexts(), id );    }    /*     **********************************************************************     * Package-scope interfaces     **********************************************************************/    /**      * Stores the various sources of information used for this info object.     */    protected void setInfo( Connection connection,			    ClientDelegate delegate,                             IOR effectiveTargetIOR,                            IIOPProfile profile,                             int requestId,                            String opName,                            boolean isOneWay,                            ServiceContexts svc )     {	this.connection = connection;        this.clientDelegate = delegate;	this.targetIOR = delegate.getIOR();        this.effectiveTargetIOR = effectiveTargetIOR;        this.profile = profile;        this.requestId = requestId;        this.opName = opName;        this.isOneWay = isOneWay;        this.serviceContexts = svc;    }        /**      * Stores the various sources of information used for this info object.     */    protected void setInfo( ClientResponse response ) {        this.response = response;    }    /**     * Set or reset the retry request flag.       */    void setRetryRequest( boolean retryRequest ) {        this.retryRequest = retryRequest;    }        /**     * Retrieve the current retry request status.     */    boolean getRetryRequest() {        return this.retryRequest;    }        /**     * Increases the entry count by 1.     */    void incrementEntryCount() {        this.entryCount++;    }        /**     * Decreases the entry count by 1.     */    void decrementEntryCount() {        this.entryCount--;    }        /**     * Retrieve the current entry count     */    int getEntryCount() {        return this.entryCount;    }        /**     * Overridden from RequestInfoImpl.  Calls the super class, then     * sets the ending point call depending on the reply status.     */    protected void setReplyStatus( short replyStatus ) {        super.setReplyStatus( replyStatus );        switch( replyStatus ) {        case SUCCESSFUL.value:            endingPointCall = CALL_RECEIVE_REPLY;            break;        case SYSTEM_EXCEPTION.value:        case USER_EXCEPTION.value:            endingPointCall = CALL_RECEIVE_EXCEPTION;            break;        case LOCATION_FORWARD.value:        case TRANSPORT_RETRY.value:            endingPointCall = CALL_RECEIVE_OTHER;            break;        }    }    /**     * Sets DII request object in the RequestInfoObject.     */    protected void setDIIRequest(org.omg.CORBA.Request req) {         request = req;    }    /**     * Keeps track of whether initiate was called for a DII request.  The ORB     * needs to know this so it knows whether to ignore a second call to     * initiateClientPIRequest or not.     */    protected void setDIIInitiate( boolean diiInitiate ) {	this.diiInitiate = diiInitiate;    }    /**     * See comment for setDIIInitiate      */    protected boolean isDIIInitiate() {	return this.diiInitiate;    }    /**     * The PICurrent stack should only be popped if it was pushed.     * This is generally the case.  But exceptions which occur     * after the stub's entry to _request but before the push     * end up in _releaseReply which will try to pop unless told not to.     */    protected void setPICurrentPushed( boolean piCurrentPushed ) {	this.piCurrentPushed = piCurrentPushed;    }    protected boolean isPICurrentPushed() {	return this.piCurrentPushed;    }    /**     * Overridden from RequestInfoImpl.     */    protected void setException( Exception exception ) {        super.setException( exception );	// Clear cached values:	cachedReceivedException = null;	cachedReceivedExceptionId = null;    }    protected boolean getIsOneWay() {	return this.isOneWay;    }    /**     * Returns the reference to the ClientDelegate object     */    protected ClientDelegate getClientDelegate() {        return this.clientDelegate;    }    /**     * See description for RequestInfoImpl.checkAccess     */    protected void checkAccess( int methodID )         throws BAD_INV_ORDER     {        // Make sure currentPoint matches the appropriate index in the        // validCall table:        int validCallIndex = 0;        switch( currentExecutionPoint ) {        case EXECUTION_POINT_STARTING:            switch( startingPointCall ) {            case CALL_SEND_REQUEST:                validCallIndex = 0;                break;            case CALL_SEND_POLL:                validCallIndex = 1;                break;            }            break;        case EXECUTION_POINT_ENDING:            switch( endingPointCall ) {            case CALL_RECEIVE_REPLY:                validCallIndex = 2;                break;            case CALL_RECEIVE_EXCEPTION:                validCallIndex = 3;                break;            case CALL_RECEIVE_OTHER:                validCallIndex = 4;                break;            }            break;        }                // Check the validCall table:        if( !validCall[methodID][validCallIndex] ) {            throw new BAD_INV_ORDER(                 "Cannot access this info attribute/method at this point.",                MinorCodes.INVALID_PI_CALL, CompletionStatus.COMPLETED_NO );        }    }    }

⌨️ 快捷键说明

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