eolivelli commented on a change in pull request #12120:
URL: https://github.com/apache/pulsar/pull/12120#discussion_r714749120
##########
File path:
pulsar-metadata/src/main/java/org/apache/pulsar/metadata/impl/AbstractMetadataStore.java
##########
@@ -246,6 +261,18 @@ public void registerSessionListener(Consumer<SessionEvent>
listener) {
}
protected void receivedSessionEvent(SessionEvent event) {
+ switch (event) {
Review comment:
this code is the same we added recently.
what about adding an utility method in SessionEvent
```
public boolean isConnected() {
switch (event) {
case Reconnected:
case SessionReestablished:
isConnected = true;
break;
case ConnectionLost:
case SessionLost:
isConnected = false;
break;
}
return isConnected;
}
```
##########
File path:
pulsar-metadata/src/main/java/org/apache/pulsar/metadata/impl/AbstractMetadataStore.java
##########
@@ -65,6 +67,9 @@
private final AsyncLoadingCache<String, Boolean> existsCache;
private final CopyOnWriteArrayList<MetadataCacheImpl<?>> metadataCaches =
new CopyOnWriteArrayList<>();
+ @Getter
+ private boolean isConnected = true;
Review comment:
@merlimat what about adding a comment ? otherwise in the future someone
else could send a patch to add `volatile`
--
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]