/// <summary> /// 执行调用(设置异步状态) /// </summary> /// <param name="sessionId">sessionId</param> /// <param name="stateAsync">异步状态</param> /// <param name="context">请求上下文</param> public static void Process(string sessionId, JsonRpcStateAsync stateAsync, object context = null) { Task.Factory.StartNew((async) => { var args = (Tuple <string, JsonRpcStateAsync, object>)async; ProcessJsonRpcState(args.Item1, args.Item2, args.Item3); }, new Tuple <string, JsonRpcStateAsync, object>(sessionId, stateAsync, context)); }
/// <summary> /// 执行调用,(设置异步状态) /// </summary> /// <param name="sessionId">sessionId</param> /// <param name="stateAsync">异步状态</param> /// <param name="context">请求上下文</param> internal static void ProcessJsonRpcState(string sessionId, JsonRpcStateAsync stateAsync, object context = null) { stateAsync.Result = Execute(sessionId, stateAsync.JsonRpc, context); stateAsync.SetCompleted(); }
/// <summary> /// 执行调用,(设置异步状态) /// </summary> /// <param name="stateAsync">异步状态</param> /// <param name="context">请求上下文</param> internal static void ProcessJsonRpcState(JsonRpcStateAsync stateAsync, object context = null) { ProcessJsonRpcState(Handler.DefaultSessionId, stateAsync, context); }