📄 clientrequestinfoimpl.java
字号:
return cachedOperationContext; } /** * See RequestInfoImpl for javadoc. */ public Any result (){ checkAccess( MID_RESULT ); if( cachedResult == null ) { if( request == null ) { throw stdWrapper.piOperationNotSupported5() ; } // Get the result from the DII request data. NamedValue nvResult = request.result( ); if( nvResult == null ) { throw wrapper.piDiiResultIsNull() ; } 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 ! messageMediator.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 stdWrapper.invalidPiCall1() ; } // 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 = getLocatedIOR(); return iorToObject(ior); } private IOR getLocatedIOR() { IOR ior; CorbaContactInfoList contactInfoList = (CorbaContactInfoList) messageMediator.getContactInfo().getContactInfoList(); ior = contactInfoList.getEffectiveTargetIOR(); return ior; } protected void setLocatedIOR(IOR ior) { ORB orb = (ORB) messageMediator.getBroker(); CorbaContactInfoListIterator iterator = (CorbaContactInfoListIterator) ((CorbaInvocationInfo)orb.getInvocationInfo()) .getContactInfoListIterator(); // REVISIT - this most likely causes reportRedirect to happen twice. // Once here and once inside the request dispatcher. iterator.reportRedirect( (CorbaContactInfo)messageMediator.getContactInfo(), 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, messageMediator.getRequestServiceContexts(), 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 ); if( cachedReplyServiceContexts == null ) { cachedReplyServiceContexts = new HashMap(); } // In the event this is called from a oneway, we will have no // response object. // // In the event this is called after a IIOPConnection.purgeCalls, // 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. try { ServiceContexts serviceContexts = messageMediator.getReplyServiceContexts(); if (serviceContexts == null) { throw new NullPointerException(); } return getServiceContext(cachedReplyServiceContexts, serviceContexts, id); } catch (NullPointerException e) { // REVISIT how this is programmed - not what it does. // See purge calls test. The waiter is woken up by the // call to purge calls - but there is no reply containing // service contexts. throw stdWrapper.invalidServiceContextId( e ) ; } } // // REVISIT // Override RequestInfoImpl connection to work in framework. // public com.sun.corba.se.spi.legacy.connection.Connection connection() { return (com.sun.corba.se.spi.legacy.connection.Connection) messageMediator.getConnection(); } /* ********************************************************************** * Package-scope interfaces **********************************************************************/ protected void setInfo(MessageMediator messageMediator) { this.messageMediator = (CorbaMessageMediator)messageMediator; // REVISIT - so mediator can handle DII in subcontract. this.messageMediator.setDIIInfo(request); } /** * 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 ! response_expected(); } /** * 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 stdWrapper.invalidPiCall2() ; } } }// End of file.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -