📄 corbaclientrequestdispatcherimpl.java
字号:
} public InputObject marshalingComplete1( ORB orb, CorbaMessageMediator messageMediator) throws ApplicationException, org.omg.CORBA.portable.RemarshalException { try { messageMediator.finishSendingRequest(); if (orb.subcontractDebugFlag) { dprint(".marshalingComplete: " + opAndId(messageMediator) + ": finished sending request"); } return messageMediator.waitForResponse(); } catch (RuntimeException e) { if (orb.subcontractDebugFlag) { dprint(".marshalingComplete: " + opAndId(messageMediator) + ": exception: " + e.toString()); } boolean retry = getContactInfoListIterator(orb) .reportException(messageMediator.getContactInfo(), e); if (retry) { // Must run interceptor end point before retrying. Exception newException = orb.getPIHandler().invokeClientPIEndingPoint( ReplyMessage.SYSTEM_EXCEPTION, e); if (newException == e) { continueOrThrowSystemOrRemarshal(messageMediator, new RemarshalException()); } else { continueOrThrowSystemOrRemarshal(messageMediator, newException); } } else { // NOTE: Interceptor ending point will run in releaseReply. throw e; } return null; // for compiler } } protected InputObject processResponse(ORB orb, CorbaMessageMediator messageMediator, InputObject inputObject) throws ApplicationException, org.omg.CORBA.portable.RemarshalException { ORBUtilSystemException wrapper = ORBUtilSystemException.get( orb, CORBALogDomains.RPC_PROTOCOL ) ; if (orb.subcontractDebugFlag) { dprint(".processResponse: " + opAndId(messageMediator) + ": response received"); } // We know for sure now that we've sent a message. // So OK to not send initial again. if (messageMediator.getConnection() != null) { ((CorbaConnection)messageMediator.getConnection()) .setPostInitialContexts(); } // NOTE: not necessary to set MessageMediator for PI. // It already has it. // Process the response. Exception exception = null; if (messageMediator.isOneWay()) { getContactInfoListIterator(orb) .reportSuccess(messageMediator.getContactInfo()); // Invoke Portable Interceptors with receive_other exception = orb.getPIHandler().invokeClientPIEndingPoint( ReplyMessage.NO_EXCEPTION, exception ); continueOrThrowSystemOrRemarshal(messageMediator, exception); return null; } consumeServiceContexts(orb, messageMediator); // Now that we have the service contexts processed and the // correct ORBVersion set, we must finish initializing the stream. // REVISIT - need interface for this operation. ((CDRInputObject)inputObject).performORBVersionSpecificInit(); if (messageMediator.isSystemExceptionReply()) { SystemException se = messageMediator.getSystemExceptionReply(); if (orb.subcontractDebugFlag) { dprint(".processResponse: " + opAndId(messageMediator) + ": received system exception: " + se); } boolean doRemarshal = getContactInfoListIterator(orb) .reportException(messageMediator.getContactInfo(), se); if (doRemarshal) { // Invoke Portable Interceptors with receive_exception: exception = orb.getPIHandler().invokeClientPIEndingPoint( ReplyMessage.SYSTEM_EXCEPTION, se ); // If PI did not change the exception, throw a // Remarshal. if( se == exception ) { // exception = null is to maintain symmetry with // GenericPOAClientSC. exception = null; continueOrThrowSystemOrRemarshal(messageMediator, new RemarshalException()); throw wrapper.statementNotReachable1() ; } else { // Otherwise, throw the exception PI wants thrown. continueOrThrowSystemOrRemarshal(messageMediator, exception); throw wrapper.statementNotReachable2() ; } } // No retry, so see if was unknown. ServiceContexts contexts = messageMediator.getReplyServiceContexts(); if (contexts != null) { UEInfoServiceContext usc = (UEInfoServiceContext) contexts.get(UEInfoServiceContext.SERVICE_CONTEXT_ID); if (usc != null) { Throwable unknown = usc.getUE() ; UnknownException ue = new UnknownException(unknown); // Invoke Portable Interceptors with receive_exception: exception = orb.getPIHandler().invokeClientPIEndingPoint( ReplyMessage.SYSTEM_EXCEPTION, ue ); continueOrThrowSystemOrRemarshal(messageMediator, exception); throw wrapper.statementNotReachable3() ; } } // It was not a comm failure nor unknown. // This is the general case. // Invoke Portable Interceptors with receive_exception: exception = orb.getPIHandler().invokeClientPIEndingPoint( ReplyMessage.SYSTEM_EXCEPTION, se ); continueOrThrowSystemOrRemarshal(messageMediator, exception); // Note: We should never need to execute this line, but // we should assert in case exception is null somehow. throw wrapper.statementNotReachable4() ; } else if (messageMediator.isUserExceptionReply()) { if (orb.subcontractDebugFlag) { dprint(".processResponse: " + opAndId(messageMediator) + ": received user exception"); } getContactInfoListIterator(orb) .reportSuccess(messageMediator.getContactInfo()); String exceptionRepoId = peekUserExceptionId(inputObject); Exception newException = null; if (messageMediator.isDIIRequest()) { exception = messageMediator.unmarshalDIIUserException( exceptionRepoId, (InputStream)inputObject); newException = orb.getPIHandler().invokeClientPIEndingPoint( ReplyMessage.USER_EXCEPTION, exception ); messageMediator.setDIIException(newException); } else { ApplicationException appException = new ApplicationException( exceptionRepoId, (org.omg.CORBA.portable.InputStream)inputObject); exception = appException; newException = orb.getPIHandler().invokeClientPIEndingPoint( ReplyMessage.USER_EXCEPTION, appException ); } if (newException != exception) { continueOrThrowSystemOrRemarshal(messageMediator,newException); } if (newException instanceof ApplicationException) { throw (ApplicationException)newException; } // For DII: // This return will be ignored - already unmarshaled above. return inputObject; } else if (messageMediator.isLocationForwardReply()) { if (orb.subcontractDebugFlag) { dprint(".processResponse: " + opAndId(messageMediator) + ": received location forward"); } // NOTE: Expects iterator to update target IOR getContactInfoListIterator(orb).reportRedirect( (CorbaContactInfo)messageMediator.getContactInfo(), messageMediator.getForwardedIOR()); // Invoke Portable Interceptors with receive_other: Exception newException = orb.getPIHandler().invokeClientPIEndingPoint( ReplyMessage.LOCATION_FORWARD, null ); if( !(newException instanceof RemarshalException) ) { exception = newException; } // If PI did not change exception, throw Remarshal, else // throw the exception PI wants thrown. // KMC: GenericPOAClientSC did not check exception != null if( exception != null ) { continueOrThrowSystemOrRemarshal(messageMediator, exception); } continueOrThrowSystemOrRemarshal(messageMediator, new RemarshalException()); throw wrapper.statementNotReachable5() ; } else if (messageMediator.isDifferentAddrDispositionRequestedReply()){ if (orb.subcontractDebugFlag) { dprint(".processResponse: " + opAndId(messageMediator) + ": received different addressing dispostion request"); } // Set the desired target addressing disposition. getContactInfoListIterator(orb).reportAddrDispositionRetry( (CorbaContactInfo)messageMediator.getContactInfo(), messageMediator.getAddrDispositionReply()); // Invoke Portable Interceptors with receive_other: Exception newException = orb.getPIHandler().invokeClientPIEndingPoint( ReplyMessage.NEEDS_ADDRESSING_MODE, null); // For consistency with corresponding code in GenericPOAClientSC: if( !(newException instanceof RemarshalException) ) { exception = newException; } // If PI did not change exception, throw Remarshal, else // throw the exception PI wants thrown. // KMC: GenericPOAClientSC did not include exception != null check if( exception != null ) { continueOrThrowSystemOrRemarshal(messageMediator, exception); } continueOrThrowSystemOrRemarshal(messageMediator, new RemarshalException()); throw wrapper.statementNotReachable6() ; } else /* normal response */ { if (orb.subcontractDebugFlag) { dprint(".processResponse: " + opAndId(messageMediator) + ": received normal response"); } getContactInfoListIterator(orb) .reportSuccess(messageMediator.getContactInfo()); messageMediator.handleDIIReply((InputStream)inputObject); // Invoke Portable Interceptors with receive_reply: exception = orb.getPIHandler().invokeClientPIEndingPoint( ReplyMessage.NO_EXCEPTION, null ); // Remember: not thrown if exception is null. continueOrThrowSystemOrRemarshal(messageMediator, exception); return inputObject; } } // Filters the given exception into a SystemException or a // RemarshalException and throws it. Assumes the given exception is // of one of these two types. This is a utility method for // the above invoke code which must do this numerous times. // If the exception is null, no exception is thrown. // // Note that this code is duplicated in GenericPOAClientSC.java protected void continueOrThrowSystemOrRemarshal( CorbaMessageMediator messageMediator, Exception exception) throws SystemException, RemarshalException { ORB orb = (ORB) messageMediator.getBroker(); if( exception == null ) { // do nothing. } else if( exception instanceof RemarshalException ) { // REVISIT - unify with PI handling orb.getInvocationInfo().setIsRetryInvocation(true); // NOTE - We must unregister the waiter NOW for this request // since the retry will result in a new request id. Therefore // the old request id would be lost and we would have a memory // leak in the responseWaitingRoom. unregisterWaiter(orb); if (orb.subcontractDebugFlag) { dprint(".continueOrThrowSystemOrRemarshal: " + opAndId(messageMediator) + ": throwing Remarshal"); } throw (RemarshalException)exception; } else { if (orb.subcontractDebugFlag) { dprint(".continueOrThrowSystemOrRemarshal: " + opAndId(messageMediator)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -