private static void ForceDoneChain(ClientContextChain contextChain) { try { //有可能是 Done 引发了异常,需要处理一下。 contextChain.Done(); } catch (Exception ex) { ex.ThrowIfNecessary(); } }
private object InnerInvoke(IRequestChannel channel, TChannelBufferInputTransport inputTransport, TChannelBufferOutputTransport outputTransport, TProtocol inputProtocol, TProtocol outputProtocol, int sequenceId, ClientContextChain contextChain, object[] args) { if (_invokeAsynchronously) { // This method declares a Future return value: run it asynchronously return(AsynchronousInvoke(channel, inputTransport, outputTransport, inputProtocol, outputProtocol, sequenceId, contextChain, args)); } else { try { // This method declares an immediate return value: run it synchronously return(SynchronousInvoke(channel, inputTransport, outputTransport, inputProtocol, outputProtocol, sequenceId, contextChain, args)); } finally { contextChain.Done(); } } }