make call object implement IDisposable

pull/1648/head
Jan Tattermusch 10 years ago
parent acfcfeffb6
commit bdf2e623ef
  1. 14
      src/csharp/Grpc.Core/AsyncClientStreamingCall.cs
  2. 14
      src/csharp/Grpc.Core/AsyncDuplexStreamingCall.cs
  3. 14
      src/csharp/Grpc.Core/AsyncServerStreamingCall.cs

@ -40,7 +40,7 @@ namespace Grpc.Core
/// <summary> /// <summary>
/// Return type for client streaming calls. /// Return type for client streaming calls.
/// </summary> /// </summary>
public sealed class AsyncClientStreamingCall<TRequest, TResponse> public sealed class AsyncClientStreamingCall<TRequest, TResponse> : IDisposable
{ {
readonly IClientStreamWriter<TRequest> requestStream; readonly IClientStreamWriter<TRequest> requestStream;
readonly Task<TResponse> result; readonly Task<TResponse> result;
@ -81,5 +81,17 @@ namespace Grpc.Core
{ {
return result.GetAwaiter(); return result.GetAwaiter();
} }
/// <summary>
/// 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.
/// </summary>
public void Dispose()
{
// TODO(jtattermusch): implement
throw new NotImplementedException();
}
} }
} }

@ -40,7 +40,7 @@ namespace Grpc.Core
/// <summary> /// <summary>
/// Return type for bidirectional streaming calls. /// Return type for bidirectional streaming calls.
/// </summary> /// </summary>
public sealed class AsyncDuplexStreamingCall<TRequest, TResponse> public sealed class AsyncDuplexStreamingCall<TRequest, TResponse> : IDisposable
{ {
readonly IClientStreamWriter<TRequest> requestStream; readonly IClientStreamWriter<TRequest> requestStream;
readonly IAsyncStreamReader<TResponse> responseStream; readonly IAsyncStreamReader<TResponse> responseStream;
@ -72,5 +72,17 @@ namespace Grpc.Core
return requestStream; return requestStream;
} }
} }
/// <summary>
/// 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.
/// </summary>
public void Dispose()
{
// TODO(jtattermusch): implement
throw new NotImplementedException();
}
} }
} }

@ -40,7 +40,7 @@ namespace Grpc.Core
/// <summary> /// <summary>
/// Return type for server streaming calls. /// Return type for server streaming calls.
/// </summary> /// </summary>
public sealed class AsyncServerStreamingCall<TResponse> public sealed class AsyncServerStreamingCall<TResponse> : IDisposable
{ {
readonly IAsyncStreamReader<TResponse> responseStream; readonly IAsyncStreamReader<TResponse> responseStream;
@ -59,5 +59,17 @@ namespace Grpc.Core
return responseStream; return responseStream;
} }
} }
/// <summary>
/// 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.
/// </summary>
public void Dispose()
{
// TODO(jtattermusch): implement
throw new NotImplementedException();
}
} }
} }

Loading…
Cancel
Save