pabloem commented on a change in pull request #15418:
URL: https://github.com/apache/beam/pull/15418#discussion_r704699167
##########
File path:
sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/pubsublite/PublisherCache.java
##########
@@ -23,52 +23,50 @@
import com.google.api.core.ApiService.State;
import com.google.api.gax.rpc.ApiException;
import com.google.cloud.pubsublite.MessageMetadata;
-import com.google.cloud.pubsublite.internal.CloseableMonitor;
import com.google.cloud.pubsublite.internal.Publisher;
+import com.google.cloud.pubsublite.internal.wire.SystemExecutors;
import com.google.errorprone.annotations.concurrent.GuardedBy;
import java.util.HashMap;
-import java.util.concurrent.Executor;
-import java.util.concurrent.Executors;
import
org.apache.beam.vendor.guava.v26_0_jre.com.google.common.annotations.VisibleForTesting;
/** A map of working publishers by PublisherOptions. */
-class PublisherCache {
- private final CloseableMonitor monitor = new CloseableMonitor();
-
- private final Executor listenerExecutor =
Executors.newSingleThreadExecutor();
-
- @GuardedBy("monitor.monitor")
+class PublisherCache implements AutoCloseable {
+ @GuardedBy("this")
private final HashMap<PublisherOptions, Publisher<MessageMetadata>>
livePublishers =
new HashMap<>();
- Publisher<MessageMetadata> get(PublisherOptions options) throws ApiException
{
+ private synchronized void evict(PublisherOptions options) {
+ livePublishers.remove(options);
Review comment:
should the publisher also be 'stopped' when evicted? Or is this only
called when the publisher is being stopped?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]