You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Sep 26, 2023. It is now read-only.
#838 modified WatchDog to implement BackgroundResource and to track a Future for the work scheduled via the ExecutorService so that it can be cancelled. This is perfectly reasonable, but WatchDog.shutdown also calls ExecutorService.shutdown
This is problematic when you provide a FixedExecutorProvider to ClientContex.create since it uses the same ExecutorService instance (from the ExecutorProvider) for the WatchDog, which makes FixedExecutorProvider practically useless (since the ExecutorService that it provides can no longer be shared between clients, as shutting one down will shut down the ExecutorService)
I noticed this issue in our application while attempting to upgrade to google-cloud-core 1.92.5. We use java-pubsub 1.102.1 and we share the same ExecutorService among multiple dynamically-created Publisher instances. As soon as one is shut down, they all become inoperable since the underlying ExecutorService that they share is shut down.
Obviously, I could work around this by using an InstantiatingExecutorProvider, but I don't want to allocate new threads for every Publisher that my application creates (since the java-pubsub library requires the creation of a Publisher per topic and we publish to dynamically-created topics).
Possible solutions:
Remove the call to executor.shutdown in WatchDog.shutdown
Modify WatchDogProvider such that it accepts (and uses) an ExecutorProvider and checks ExecutorProvider.shouldAutoClose before calling shutdown on the ExecutorService
Something else?
The text was updated successfully, but these errors were encountered:
Should executor.shutdownNow() be removed from Watchdog.shutdownNow() as well ?
Since fix of #22, exactly this line, Subscriber.doStop is calling background resources shutdown, resulting with Watchdog.shutdownNow() being executed and ExecutorService being shutdown.
#838 modified WatchDog to implement BackgroundResource and to track a Future for the work scheduled via the ExecutorService so that it can be cancelled. This is perfectly reasonable, but WatchDog.shutdown also calls ExecutorService.shutdown
This is problematic when you provide a FixedExecutorProvider to ClientContex.create since it uses the same ExecutorService instance (from the ExecutorProvider) for the WatchDog, which makes FixedExecutorProvider practically useless (since the ExecutorService that it provides can no longer be shared between clients, as shutting one down will shut down the ExecutorService)
I noticed this issue in our application while attempting to upgrade to google-cloud-core 1.92.5. We use java-pubsub 1.102.1 and we share the same ExecutorService among multiple dynamically-created Publisher instances. As soon as one is shut down, they all become inoperable since the underlying ExecutorService that they share is shut down.
Obviously, I could work around this by using an InstantiatingExecutorProvider, but I don't want to allocate new threads for every Publisher that my application creates (since the java-pubsub library requires the creation of a Publisher per topic and we publish to dynamically-created topics).
Possible solutions:
The text was updated successfully, but these errors were encountered: