diff --git a/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/StreamingSubscriberConnection.java b/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/StreamingSubscriberConnection.java index 26547529e..160032c7a 100644 --- a/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/StreamingSubscriberConnection.java +++ b/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/StreamingSubscriberConnection.java @@ -191,15 +191,14 @@ protected void doStart() { @Override protected void doStop() { - runShutdown(); - lock.lock(); try { clientStream.closeSendWithError(Status.CANCELLED.asException()); } finally { lock.unlock(); - notifyStopped(); } + runShutdown(); + notifyStopped(); } private void runShutdown() {