Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
O
Openfire
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
Openfire
Commits
ee9d5150
Commit
ee9d5150
authored
Jan 26, 2016
by
Dave Cridland
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #523 from tevans/OF-1045
OF-1045: Fix NPE in cluster info page
parents
73b5e68f
35403147
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
19 deletions
+30
-19
ClusteredCacheFactory.java
...are/openfire/plugin/util/cache/ClusteredCacheFactory.java
+19
-10
system-clustering-node.jsp
src/plugins/hazelcast/src/web/system-clustering-node.jsp
+11
-9
No files found.
src/plugins/hazelcast/src/java/org/jivesoftware/openfire/plugin/util/cache/ClusteredCacheFactory.java
View file @
ee9d5150
...
...
@@ -99,6 +99,8 @@ public class ClusteredCacheFactory implements CacheFactoryStrategy {
private
static
HazelcastInstance
hazelcast
=
null
;
private
static
Cluster
cluster
=
null
;
private
ClusterListener
clusterListener
;
private
String
lifecycleListener
;
private
String
membershipListener
;
/**
* Keeps that running state. Initial state is stopped.
...
...
@@ -141,8 +143,8 @@ public class ClusteredCacheFactory implements CacheFactoryStrategy {
XMPPServer
.
getInstance
().
setNodeID
(
NodeID
.
getInstance
(
getClusterMemberID
()));
// CacheFactory is now using clustered caches. We can add our listeners.
clusterListener
=
new
ClusterListener
(
cluster
);
hazelcast
.
getLifecycleService
().
addLifecycleListener
(
clusterListener
);
cluster
.
addMembershipListener
(
clusterListener
);
lifecycleListener
=
hazelcast
.
getLifecycleService
().
addLifecycleListener
(
clusterListener
);
membershipListener
=
cluster
.
addMembershipListener
(
clusterListener
);
break
;
}
catch
(
Exception
e
)
{
if
(
retry
<
CLUSTER_STARTUP_RETRY_COUNT
)
{
...
...
@@ -172,13 +174,20 @@ public class ClusteredCacheFactory implements CacheFactoryStrategy {
// Stop the cluster
Hazelcast
.
shutdownAll
();
cluster
=
null
;
// Wait until the server has updated its internal state
while
(!
clusterListener
.
isDone
())
{
try
{
Thread
.
sleep
(
100
);
}
catch
(
InterruptedException
e
)
{
// Ignore
}
if
(
clusterListener
!=
null
)
{
// Wait until the server has updated its internal state
while
(!
clusterListener
.
isDone
())
{
try
{
Thread
.
sleep
(
100
);
}
catch
(
InterruptedException
e
)
{
// Ignore
}
}
hazelcast
.
getLifecycleService
().
removeLifecycleListener
(
lifecycleListener
);
cluster
.
removeMembershipListener
(
membershipListener
);
lifecycleListener
=
null
;
membershipListener
=
null
;
clusterListener
=
null
;
}
// Reset the node ID
XMPPServer
.
getInstance
().
setNodeID
(
null
);
...
...
@@ -225,7 +234,7 @@ public class ClusteredCacheFactory implements CacheFactoryStrategy {
}
public
Collection
<
ClusterNodeInfo
>
getClusterNodesInfo
()
{
return
clusterListener
.
getClusterNodesInfo
();
return
clusterListener
==
null
?
Collections
.
EMPTY_LIST
:
clusterListener
.
getClusterNodesInfo
();
}
public
int
getMaxClusterNodes
()
{
...
...
src/plugins/hazelcast/src/web/system-clustering-node.jsp
View file @
ee9d5150
...
...
@@ -86,19 +86,21 @@
List
<
ClusterNodeInfo
>
members
=
(
List
<
ClusterNodeInfo
>
)
CacheFactory
.
getClusterNodesInfo
();
Map
<
NodeID
,
NodeRuntimeStats
.
NodeInfo
>
nodeInfoMap
=
NodeRuntimeStats
.
getNodeInfo
();
// Sort it according to name
Collections
.
sort
(
members
,
new
Comparator
<
ClusterNodeInfo
>
()
{
public
int
compare
(
ClusterNodeInfo
member1
,
ClusterNodeInfo
member2
)
{
String
name1
=
member1
.
getHostName
()
+
" ("
+
member1
.
getNodeID
()
+
")"
;
String
name2
=
member2
.
getHostName
()
+
" ("
+
member2
.
getNodeID
()
+
")"
;
return
name1
.
toLowerCase
().
compareTo
(
name2
.
toLowerCase
().
toLowerCase
());
}
});
if
(
members
.
size
()
>
1
)
{
// Sort it according to name
Collections
.
sort
(
members
,
new
Comparator
<
ClusterNodeInfo
>
()
{
public
int
compare
(
ClusterNodeInfo
member1
,
ClusterNodeInfo
member2
)
{
String
name1
=
member1
.
getHostName
()
+
" ("
+
member1
.
getNodeID
()
+
")"
;
String
name2
=
member2
.
getHostName
()
+
" ("
+
member2
.
getNodeID
()
+
")"
;
return
name1
.
toLowerCase
().
compareTo
(
name2
.
toLowerCase
().
toLowerCase
());
}
});
}
// If no UID was used, use the UID from the first member in the member list
byte
[]
byteArray
;
if
(
uid
==
null
)
{
byteArray
=
members
.
get
(
0
).
getNodeID
().
toByteArray
();
byteArray
=
members
.
isEmpty
()
?
new
byte
[]
{
0
}
:
members
.
get
(
0
).
getNodeID
().
toByteArray
();
}
else
{
byteArray
=
Base64
.
decode
(
uid
,
Base64
.
URL_SAFE
);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment