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
597c312b
Commit
597c312b
authored
Feb 12, 2018
by
Greg Thomas
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
HZ-5: Ensure nodes start as junior to trigger promotion
parent
6f4473d8
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
5 deletions
+13
-5
ClusterListener.java
...esoftware/openfire/plugin/util/cache/ClusterListener.java
+12
-4
ClusteredCacheFactory.java
...are/openfire/plugin/util/cache/ClusteredCacheFactory.java
+1
-1
No files found.
src/plugins/hazelcast/src/java/org/jivesoftware/openfire/plugin/util/cache/ClusterListener.java
View file @
597c312b
...
@@ -106,7 +106,7 @@ public class ClusterListener implements MembershipListener, LifecycleListener {
...
@@ -106,7 +106,7 @@ public class ClusterListener implements MembershipListener, LifecycleListener {
private
final
Map
<
NodeID
,
Set
<
String
>[]>
nodeSessions
=
new
ConcurrentHashMap
<>();
private
final
Map
<
NodeID
,
Set
<
String
>[]>
nodeSessions
=
new
ConcurrentHashMap
<>();
private
final
Map
<
NodeID
,
Set
<
DomainPair
>>
nodeRoutes
=
new
ConcurrentHashMap
<>();
private
final
Map
<
NodeID
,
Set
<
DomainPair
>>
nodeRoutes
=
new
ConcurrentHashMap
<>();
private
final
Map
<
NodeID
,
Map
<
String
,
Collection
<
String
>>>
nodePresences
=
new
ConcurrentHashMap
<>();
private
final
Map
<
NodeID
,
Map
<
String
,
Collection
<
String
>>>
nodePresences
=
new
ConcurrentHashMap
<>();
private
boolean
seniorClusterMember
=
CacheFactory
.
isSeniorClusterMember
()
;
private
boolean
seniorClusterMember
=
false
;
private
final
Map
<
Cache
<?,?>,
EntryListener
>
entryListeners
=
new
HashMap
<>();
private
final
Map
<
Cache
<?,?>,
EntryListener
>
entryListeners
=
new
HashMap
<>();
...
@@ -119,6 +119,10 @@ public class ClusterListener implements MembershipListener, LifecycleListener {
...
@@ -119,6 +119,10 @@ public class ClusterListener implements MembershipListener, LifecycleListener {
* up (e.g. changing caches implementations) is done before destroying the plugin.
* up (e.g. changing caches implementations) is done before destroying the plugin.
*/
*/
private
boolean
done
=
true
;
private
boolean
done
=
true
;
/**
* Flag that indicates if we've joined a cluster or not
*/
private
boolean
clusterMember
=
false
;
ClusterListener
(
Cluster
cluster
)
{
ClusterListener
(
Cluster
cluster
)
{
...
@@ -597,8 +601,6 @@ public class ClusterListener implements MembershipListener, LifecycleListener {
...
@@ -597,8 +601,6 @@ public class ClusterListener implements MembershipListener, LifecycleListener {
if
(!
isDone
())
{
// already joined
if
(!
isDone
())
{
// already joined
return
;
return
;
}
}
// Trigger events
ClusterManager
.
fireJoinedCluster
(
false
);
addEntryListener
(
C2SCache
,
new
CacheListener
(
this
,
C2SCache
.
getName
()));
addEntryListener
(
C2SCache
,
new
CacheListener
(
this
,
C2SCache
.
getName
()));
addEntryListener
(
anonymousC2SCache
,
new
CacheListener
(
this
,
anonymousC2SCache
.
getName
()));
addEntryListener
(
anonymousC2SCache
,
new
CacheListener
(
this
,
anonymousC2SCache
.
getName
()));
addEntryListener
(
S2SCache
,
new
S2SCacheListener
());
addEntryListener
(
S2SCache
,
new
S2SCacheListener
());
...
@@ -622,7 +624,9 @@ public class ClusterListener implements MembershipListener, LifecycleListener {
...
@@ -622,7 +624,9 @@ public class ClusterListener implements MembershipListener, LifecycleListener {
simulateCacheInserts
(
incomingServerSessionsCache
);
simulateCacheInserts
(
incomingServerSessionsCache
);
simulateCacheInserts
(
directedPresencesCache
);
simulateCacheInserts
(
directedPresencesCache
);
// Trigger events
clusterMember
=
true
;
ClusterManager
.
fireJoinedCluster
(
false
);
if
(
CacheFactory
.
isSeniorClusterMember
())
{
if
(
CacheFactory
.
isSeniorClusterMember
())
{
seniorClusterMember
=
true
;
seniorClusterMember
=
true
;
ClusterManager
.
fireMarkedAsSeniorClusterMember
();
ClusterManager
.
fireMarkedAsSeniorClusterMember
();
...
@@ -636,6 +640,7 @@ public class ClusterListener implements MembershipListener, LifecycleListener {
...
@@ -636,6 +640,7 @@ public class ClusterListener implements MembershipListener, LifecycleListener {
if
(
isDone
())
{
// not a cluster member
if
(
isDone
())
{
// not a cluster member
return
;
return
;
}
}
clusterMember
=
false
;
seniorClusterMember
=
false
;
seniorClusterMember
=
false
;
// Clean up all traces. This will set all remote sessions as unavailable
// Clean up all traces. This will set all remote sessions as unavailable
List
<
NodeID
>
nodeIDs
=
new
ArrayList
<>(
nodeSessions
.
keySet
());
List
<
NodeID
>
nodeIDs
=
new
ArrayList
<>(
nodeSessions
.
keySet
());
...
@@ -789,4 +794,7 @@ public class ClusterListener implements MembershipListener, LifecycleListener {
...
@@ -789,4 +794,7 @@ public class ClusterListener implements MembershipListener, LifecycleListener {
}
}
boolean
isClusterMember
()
{
return
clusterMember
;
}
}
}
src/plugins/hazelcast/src/java/org/jivesoftware/openfire/plugin/util/cache/ClusteredCacheFactory.java
View file @
597c312b
...
@@ -244,7 +244,7 @@ public class ClusteredCacheFactory implements CacheFactoryStrategy {
...
@@ -244,7 +244,7 @@ public class ClusteredCacheFactory implements CacheFactoryStrategy {
@Override
@Override
public
boolean
isSeniorClusterMember
()
{
public
boolean
isSeniorClusterMember
()
{
if
(
cluster
==
null
)
{
if
(
cluster
Listener
==
null
||
!
clusterListener
.
isClusterMember
()
)
{
return
false
;
return
false
;
}
}
// first cluster member is the oldest
// first cluster member is the oldest
...
...
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