public void Dispose() { if (m_OnDispose != null) { m_OnDispose(); } if (m_Target != null) { GrpcCallInvokerContext.RemoveState(m_Target); m_Target = null; } GC.SuppressFinalize(this); }
/// <summary> /// 指定されたメソッド呼び出しを登録します。 /// </summary> /// <typeparam name="TRequest">リクエストの型</typeparam> /// <typeparam name="TResponse">レスポンスの型</typeparam> /// <param name="call">呼び出しオブジェクト</param> /// <param name="method">メソッド</param> /// <param name="host">ホスト</param> /// <param name="options">オプション</param> /// <returns>呼び出しオブジェクト</returns> internal static AsyncUnaryCall <TResponse> Regist <TRequest, TResponse>(AsyncUnaryCall <TResponse> call, Method <TRequest, TResponse> method, string host, CallOptions options) { GrpcCallInvokerContext.Releaser releaser = new GrpcCallInvokerContext.Releaser(delegate() { call.Dispose(); }); AsyncUnaryCall <TResponse> wrap = new AsyncUnaryCall <TResponse>( call.ResponseAsync , call.ResponseHeadersAsync , call.GetStatus , call.GetTrailers , releaser.Dispose ); releaser.Target = wrap; GrpcCallInvokerContext.AddState(wrap, new GrpcCallState(method, host, options)); return(wrap); }
/// <summary> /// 指定されたメソッド呼び出しを登録します。 /// </summary> /// <typeparam name="TRequest">リクエストの型</typeparam> /// <typeparam name="TResponse">レスポンスの型</typeparam> /// <param name="call">呼び出しオブジェクト</param> /// <param name="method">メソッド</param> /// <param name="host">ホスト</param> /// <param name="options">オプション</param> /// <param name="performanceListener">パフォーマンスリスナー</param> /// <returns>呼び出しオブジェクト</returns> internal static AsyncServerStreamingCall <TResponse> Regist <TRequest, TResponse>(AsyncServerStreamingCall <TResponse> call, Method <TRequest, TResponse> method, string host, CallOptions options, GrpcClientPerformanceListener performanceListener) { GrpcCallInvokerContext.Releaser releaser = new GrpcCallInvokerContext.Releaser(delegate() { call.Dispose(); }); GrpcCallState state = new GrpcCallState(method, host, options); AsyncServerStreamingCall <TResponse> wrap = new AsyncServerStreamingCall <TResponse>( new ResponseStreamReader <TResponse>(call.ResponseStream, method, host, options, state.OnEndResponse, performanceListener) , call.ResponseHeadersAsync , call.GetStatus , call.GetTrailers , releaser.Dispose ); releaser.Target = wrap; GrpcCallInvokerContext.AddState(wrap, state); return(wrap); }