You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2021/01/25 19:42:39 UTC

[GitHub] [pulsar] merlimat commented on a change in pull request #9273: PIP-45: Added session events to metadata store

merlimat commented on a change in pull request #9273:
URL: https://github.com/apache/pulsar/pull/9273#discussion_r563995230



##########
File path: pulsar-metadata/src/main/java/org/apache/pulsar/metadata/impl/AbstractMetadataStore.java
##########
@@ -205,6 +207,21 @@ public void accept(Notification n) {
                 });
     }
 
+    @Override
+    public void registerSessionListener(Consumer<SessionEvent> listener) {
+        sessionListeners.add(listener);
+    }
+
+    protected void receivedSessionEvent(SessionEvent event) {
+        sessionListeners.forEach(l -> {
+            try {
+                l.accept(event);
+            } catch (Throwable t) {
+                log.warn("Error in processing session event", t);

Review comment:
       The `Consumer` interface doesn't allow to throw `InterruptedException` and we cannot catch that directly since it's a checked exception. If the listener code does any blocking operation, it would be its responsibility to handle the `InterruptedException`.




----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org