Beispiel #1
0
        private void CheckResponseOrderingRequirements(IChannelHandlerContext ctx, ThriftMessage message)
        {
            bool messageRequiresOrderedResponses = message.IsOrderedResponsesRequired;

            if (!DispatcherContext.IsResponseOrderingRequirementInitialized(ctx))
            {
                // This is the first request. This message will decide whether all responses on the
                // channel must be strictly ordered, or whether out-of-order is allowed.
                DispatcherContext.SetResponseOrderingRequired(ctx, messageRequiresOrderedResponses);
            }
            else if (messageRequiresOrderedResponses != DispatcherContext.IsResponseOrderingRequired(ctx))
            {
                // This is not the first request. Verify that the ordering requirement on this message
                // is consistent with the requirement on the channel itself.
                throw new NiftyException("Every message on a single channel must specify the same requirement for response ordering");
            }
        }