use of org.jivesoftware.openfire.muc.cluster.SyncLocalOccupantsAndSendJoinPresenceTask in project Openfire by igniterealtime.
the class MultiUserChatServiceImpl method joinedCluster.
@Override
public void joinedCluster() {
final String fullServiceName = chatServiceName + "." + XMPPServer.getInstance().getServerInfo().getXMPPDomain();
Log.debug("Cluster event: service {} joined a cluster - going to restore {} rooms", fullServiceName, localMUCRoomManager.size());
// The local node joined a cluster.
// Upon joining a cluster, clustered caches are reset to their clustered equivalent (by the swap from the local
// cache implementation to the clustered cache implementation that's done in the implementation of
// org.jivesoftware.util.cache.CacheFactory.joinedCluster). This means that they now hold data that's
// available on all other cluster nodes. Data that's available on the local node needs to be added again.
final Set<OccupantManager.Occupant> occupantsToSync = localMUCRoomManager.restoreCacheContentAfterJoin(occupantManager);
Log.debug("Occupants to sync: {}", occupantsToSync);
// cluster (OF-2224) and should tell its local users that new occupants have joined (OF-2233).
if (!occupantsToSync.isEmpty()) {
CacheFactory.doClusterTask(new SyncLocalOccupantsAndSendJoinPresenceTask(this.chatServiceName, occupantsToSync));
}
// TODO does this work properly when the rooms are not known on the other nodes?
}
use of org.jivesoftware.openfire.muc.cluster.SyncLocalOccupantsAndSendJoinPresenceTask in project Openfire by igniterealtime.
the class MultiUserChatServiceImpl method joinedCluster.
@Override
public void joinedCluster(byte[] nodeID) {
final String fullServiceName = chatServiceName + "." + XMPPServer.getInstance().getServerInfo().getXMPPDomain();
Log.debug("Cluster event: service {} got notified that node {} joined a cluster", fullServiceName, new String(nodeID));
// Another node joined a cluster that we're already part of.
// Let the new node know about our local occupants, as it needs this information when it might leave the cluster
// again (OF-2224). The data is also needed for the joined node to be able to tell its local users that other
// occupants have now joined a MUC room that they're in (OF-2233). To generate these stanzas, the receiving node
// will probably need additional information. It can obtain this from the clustered cache. Even though we can't
// be sure if that node has fully added _its own_ data to that cache (we don't know if restoreCacheContent()
// has finished execution), we can be sure that the cache already holds data as provided by _us_.
final Set<OccupantManager.Occupant> localOccupants = occupantManager.getLocalOccupants();
CacheFactory.doClusterTask(new SyncLocalOccupantsAndSendJoinPresenceTask(this.chatServiceName, localOccupants), nodeID);
}
Aggregations