From bdf2e623efe89cb1dd72c3b0de89ecf304f1173d Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Mon, 18 May 2015 15:59:02 -0700 Subject: make call object implement IDisposable --- src/csharp/Grpc.Core/AsyncClientStreamingCall.cs | 14 +++++++++++++- src/csharp/Grpc.Core/AsyncDuplexStreamingCall.cs | 14 +++++++++++++- src/csharp/Grpc.Core/AsyncServerStreamingCall.cs | 14 +++++++++++++- 3 files changed, 39 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/csharp/Grpc.Core/AsyncClientStreamingCall.cs b/src/csharp/Grpc.Core/AsyncClientStreamingCall.cs index 8cdc1c895b..83231ce4df 100644 --- a/src/csharp/Grpc.Core/AsyncClientStreamingCall.cs +++ b/src/csharp/Grpc.Core/AsyncClientStreamingCall.cs @@ -40,7 +40,7 @@ namespace Grpc.Core /// /// Return type for client streaming calls. /// - public sealed class AsyncClientStreamingCall + public sealed class AsyncClientStreamingCall : IDisposable { readonly IClientStreamWriter requestStream; readonly Task result; @@ -81,5 +81,17 @@ namespace Grpc.Core { return result.GetAwaiter(); } + + /// + /// Provides means to provide after the call. + /// If the call has already finished normally (request stream has been completed and call result has been received), doesn't do anything. + /// Otherwise, requests cancellation of the call which should terminate all pending async operations associated with the call. + /// As a result, all resources being used by the call should be released eventually. + /// + public void Dispose() + { + // TODO(jtattermusch): implement + throw new NotImplementedException(); + } } } diff --git a/src/csharp/Grpc.Core/AsyncDuplexStreamingCall.cs b/src/csharp/Grpc.Core/AsyncDuplexStreamingCall.cs index 0d13a3d052..39a54cc9a3 100644 --- a/src/csharp/Grpc.Core/AsyncDuplexStreamingCall.cs +++ b/src/csharp/Grpc.Core/AsyncDuplexStreamingCall.cs @@ -40,7 +40,7 @@ namespace Grpc.Core /// /// Return type for bidirectional streaming calls. /// - public sealed class AsyncDuplexStreamingCall + public sealed class AsyncDuplexStreamingCall : IDisposable { readonly IClientStreamWriter requestStream; readonly IAsyncStreamReader responseStream; @@ -72,5 +72,17 @@ namespace Grpc.Core return requestStream; } } + + /// + /// Provides means to cleanup after the call. + /// If the call has already finished normally (request stream has been completed and response stream has been fully read), doesn't do anything. + /// Otherwise, requests cancellation of the call which should terminate all pending async operations associated with the call. + /// As a result, all resources being used by the call should be released eventually. + /// + public void Dispose() + { + // TODO(jtattermusch): implement + throw new NotImplementedException(); + } } } diff --git a/src/csharp/Grpc.Core/AsyncServerStreamingCall.cs b/src/csharp/Grpc.Core/AsyncServerStreamingCall.cs index 6a258d132c..1036f4a3ec 100644 --- a/src/csharp/Grpc.Core/AsyncServerStreamingCall.cs +++ b/src/csharp/Grpc.Core/AsyncServerStreamingCall.cs @@ -40,7 +40,7 @@ namespace Grpc.Core /// /// Return type for server streaming calls. /// - public sealed class AsyncServerStreamingCall + public sealed class AsyncServerStreamingCall : IDisposable { readonly IAsyncStreamReader responseStream; @@ -59,5 +59,17 @@ namespace Grpc.Core return responseStream; } } + + /// + /// Provides means to cleanup after the call. + /// If the call has already finished normally (response stream has been fully read), doesn't do anything. + /// Otherwise, requests cancellation of the call which should terminate all pending async operations associated with the call. + /// As a result, all resources being used by the call should be released eventually. + /// + public void Dispose() + { + // TODO(jtattermusch): implement + throw new NotImplementedException(); + } } } -- cgit v1.2.3