aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/python/grpcio/grpc/__init__.py
diff options
context:
space:
mode:
authorGravatar Nathaniel Manista <nathaniel@google.com>2018-05-02 23:35:00 +0000
committerGravatar Nathaniel Manista <nathaniel@google.com>2018-05-02 23:59:15 +0000
commitbccd32dafa1ed60e745c958a55960cf75c56d7d2 (patch)
tree49944d8d3df4e27226d13af8ee0d88d688ab1d7c /src/python/grpcio/grpc/__init__.py
parentca7ba4d0ac3ab452c5db60befc8be37fd6e2339b (diff)
Add grpc.Channel.close
Diffstat (limited to 'src/python/grpcio/grpc/__init__.py')
-rw-r--r--src/python/grpcio/grpc/__init__.py17
1 files changed, 16 insertions, 1 deletions
diff --git a/src/python/grpcio/grpc/__init__.py b/src/python/grpcio/grpc/__init__.py
index 7fa7303691..b7ed0c8563 100644
--- a/src/python/grpcio/grpc/__init__.py
+++ b/src/python/grpcio/grpc/__init__.py
@@ -813,7 +813,11 @@ class StreamStreamMultiCallable(six.with_metaclass(abc.ABCMeta)):
class Channel(six.with_metaclass(abc.ABCMeta)):
- """Affords RPC invocation via generic methods on client-side."""
+ """Affords RPC invocation via generic methods on client-side.
+
+ Channel objects implement the Context Manager type, although they need not
+ support being entered and exited multiple times.
+ """
@abc.abstractmethod
def subscribe(self, callback, try_to_connect=False):
@@ -926,6 +930,17 @@ class Channel(six.with_metaclass(abc.ABCMeta)):
"""
raise NotImplementedError()
+ @abc.abstractmethod
+ def close(self):
+ """Closes this Channel and releases all resources held by it.
+
+ Closing the Channel will immediately terminate all RPCs active with the
+ Channel and it is not valid to invoke new RPCs with the Channel.
+
+ This method is idempotent.
+ """
+ raise NotImplementedError()
+
########################## Service-Side Context ##############################