On startup the ClusteredCacheFactory calls the constructor of the ClusterListener, which calls the CacheFactory.isSeniorClusterMember(). This method checks if the clusterListerner object is null. This is always the case because the object is not set at this moment.
Simply implement and register a ClusterEventListener and log the method invocations.
Start a single node. joinedCluster() is called every time but markedAsSeniorClusterMember() is never called.
The JavaDoc of ClusterEventListener.joinedCluster() says:
"Notification event indicating that this JVM is now part of a cluster. At this point the
{@link org.jivesoftware.openfire.XMPPServer#getNodeID()} holds the new nodeID value.
When joining the cluster as the senior cluster member the {@link#markedAsSeniorClusterMember()}
event will be sent right after this event."
So i think it is a Bug.
All implementations of markedAsSeniorClusterMember() in the openfire repository are “no-ops” like:
@Override
public void markedAsSeniorClusterMember() {
// Do nothing
}