Skip to content

Commit

Permalink
fixes #162: Prevent issues on Admin Console when cluster has inconsis…
Browse files Browse the repository at this point in the history
…tent versions

When the senior cluster node doesn't have the monitoring plugin loaded, the admin console pages on other nodes shouldn't break. They should show a warning.
  • Loading branch information
guusdk committed Dec 23, 2021
1 parent 5980e57 commit 40d93cb
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 10 deletions.
1 change: 1 addition & 0 deletions changelog.html
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ <h1>
<ul>
<li>Requires Openfire 4.7.0</li>
<li>[<a href='https://github.com/igniterealtime/openfire-monitoring-plugin/issues/125'>Issue #125</a>] - Combining keyword and date range makes search fail</li>
<li>[<a href='https://github.com/igniterealtime/openfire-monitoring-plugin/issues/162'>Issue #162</a>] - Admin console pages should not break when not all cluster nodes have (the same) version of the plugin loaded</li>
<li>[<a href='https://github.com/igniterealtime/openfire-monitoring-plugin/issues/163'>Issue #163</a>] - Migrate Jive Globals to System Properties</li>
<li>[<a href='https://github.com/igniterealtime/openfire-monitoring-plugin/issues/190'>Issue #190</a>] - Allow code-update to force a reindexation</li>
<li>[<a href='https://github.com/igniterealtime/openfire-monitoring-plugin/issues/192'>Issue #192</a>] - Combining keyword and participant(s) makes search fail</li>
Expand Down
2 changes: 1 addition & 1 deletion plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<description>Monitors conversations and statistics of the server.</description>
<author>Ignite Realtime</author>
<version>${project.version}</version>
<date>12/08/2021</date>
<date>12/23/2021</date>
<minServerVersion>4.7.0</minServerVersion>
<minJavaVersion>1.8</minJavaVersion>
<databaseKey>monitoring</databaseKey>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -567,7 +567,13 @@ public int getConversationCount() {
if (ClusterManager.isSeniorClusterMember()) {
return conversations.size();
}
return CacheFactory.doSynchronousClusterTask(new GetConversationCountTask(), ClusterManager.getSeniorClusterMember().toByteArray());
final Integer count = CacheFactory.doSynchronousClusterTask(new GetConversationCountTask(), ClusterManager.getSeniorClusterMember().toByteArray());
if (count == null) {
Log.warn("Unable to obtain conversation count from senior cluster member. Is (the same version of) the Monitoring Plugin running there?");
return -1;
} else {
return count;
}
}

/**
Expand Down Expand Up @@ -621,14 +627,18 @@ public Collection<Conversation> getConversations() {
Collection<String> conversationXmls = CacheFactory.doSynchronousClusterTask(new GetConversationsTask(), ClusterManager
.getSeniorClusterMember().toByteArray());
Collection<Conversation> result = new ArrayList<>();
for (String conversationXml : conversationXmls) {
try {
Log.debug("Interpreting conversation from: {}", conversationXml);
final Conversation conversation = Conversation.fromXml(conversationXml);
Log.debug("Interpreted conversation: {}", conversation);
result.add(conversation);
} catch (IOException e) {
Log.warn("Conversation could not be reconstructed from '{}' because of '{}'. This conversation is not included in the result set.", conversationXml, e.getMessage());
if (conversationXmls == null) {
Log.warn("Unable to obtain conversations from senior cluster member. Is (the same version of) the Monitoring Plugin running there?");
} else {
for (String conversationXml : conversationXmls) {
try {
Log.debug("Interpreting conversation from: {}", conversationXml);
final Conversation conversation = Conversation.fromXml(conversationXml);
Log.debug("Interpreted conversation: {}", conversation);
result.add(conversation);
} catch (IOException e) {
Log.warn("Conversation could not be reconstructed from '{}' because of '{}'. This conversation is not included in the result set.", conversationXml, e.getMessage());
}
}
}
return result;
Expand Down

0 comments on commit 40d93cb

Please sign in to comment.