Commit e5d47b9
authored
pubsub: reconnect with old executor (#2498)
We register a callback to reconnect connection when old connection closes.
When we shut down the subscriber, we close all connections and
begin to shutdown executor.
There is a race: if the callback is called after executor closes,
an exception occurs and we print a scary stack trace.
It doesn't do anything bad; the subscriber is going to go away anyway,
but the stack trace is still confusing.
This commit avoids registering new jobs on executors.
When a connection closes, the callback to determine whether we should
reconnect is called in the RPC thread.
If the connection closes due to some error, the callback should quickly
determine whether we should reconnection. If so, we register the actual
reconnection job on a separate thread. This does not block RPC thread,
and everyone should be happy.
If the connection closes because we're shutting down,
the callback running on RPC thread should determine that we should NOT
reconnect, not register a reconnection job, and we shouldn't see
a stack trace.
Fixes #2485.1 parent 43d8c48 commit e5d47b9
1 file changed
Lines changed: 1 addition & 2 deletions
File tree
- google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1
Lines changed: 1 addition & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
250 | 250 | | |
251 | 251 | | |
252 | 252 | | |
253 | | - | |
254 | | - | |
| 253 | + | |
255 | 254 | | |
256 | 255 | | |
257 | 256 | | |
| |||
0 commit comments