Steps to reproduce;
Register a ClusterEventListener in a plugin. Start the plugin on a junior node in a two node cluster.
Kill the senior node in the cluster.
Wait until the remaining node is promoted.
The ClusterEventListener.leftCluster(byte) and ClusterEventListener.markedAsSeniorMember() events are fired.
Whilst the leftCluster(byte) event is fired, the markedAsSeniorMember() event is not.
Initial investigation, so I remember for later;
This happens because ClusterListener initialises seniorClusterMember on creation by calling CacheFactory.isSeniorClusterMember(). This returns true when the server first starts. Because ClusterListener already thinks it's senior, it never sends the markedAsSeniorMember() event when the other node leaves.
An easy fix (tested) is to simply set seniorClusterMember = false on creation; it will be set to true when the node starts a new cluster.
But I'm more concerned that CacheFactory.isSeniorClusterMember() is returning true; At that point in time it shouldn't be as the node is never a senior member.