当前位置: 首页>>代码示例>>Java>>正文


Java ClusterManager.fireLeftCluster方法代码示例

本文整理汇总了Java中org.jivesoftware.openfire.cluster.ClusterManager.fireLeftCluster方法的典型用法代码示例。如果您正苦于以下问题:Java ClusterManager.fireLeftCluster方法的具体用法?Java ClusterManager.fireLeftCluster怎么用?Java ClusterManager.fireLeftCluster使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.jivesoftware.openfire.cluster.ClusterManager的用法示例。


在下文中一共展示了ClusterManager.fireLeftCluster方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: leaveCluster

import org.jivesoftware.openfire.cluster.ClusterManager; //导入方法依赖的package包/类
private synchronized void leaveCluster() {
    if (isDone()) { // not a cluster member
        return;
    }
    seniorClusterMember = false;
    // Clean up all traces. This will set all remote sessions as unavailable
    List<NodeID> nodeIDs = new ArrayList<NodeID>(nodeSessions.keySet());

    // Trigger event. Wait until the listeners have processed the event. Caches will be populated
    // again with local content.
    ClusterManager.fireLeftCluster();

    if (!XMPPServer.getInstance().isShuttingDown()) {
        for (NodeID key : nodeIDs) {
            // Clean up directed presences sent from entities hosted in the leaving node to local entities
            // Clean up directed presences sent to entities hosted in the leaving node from local entities
            cleanupDirectedPresences(key);
            // Clean up no longer valid sessions
            cleanupPresences(key);
        }
        // Remove traces of directed presences sent from local entities to handlers that no longer exist
        // At this point c2s sessions are gone from the routing table so we can identify expired sessions
        XMPPServer.getInstance().getPresenceUpdateHandler().removedExpiredPresences();
    }
    logger.info("Left cluster as node: " + cluster.getLocalMember().getUuid());
    done = true;
}
 
开发者ID:igniterealtime,项目名称:Openfire,代码行数:28,代码来源:ClusterListener.java

示例2: memberRemoved

import org.jivesoftware.openfire.cluster.ClusterManager; //导入方法依赖的package包/类
public void memberRemoved(MembershipEvent event) {
    byte[] nodeID = StringUtils.getBytes(event.getMember().getUuid());

    if (event.getMember().localMember()) {
        logger.info("Leaving cluster: " + nodeID);
        // This node may have realized that it got kicked out of the cluster
        leaveCluster();
    } else {
        // Trigger event that a node left the cluster
        ClusterManager.fireLeftCluster(nodeID);

        // Clean up directed presences sent from entities hosted in the leaving node to local entities
        // Clean up directed presences sent to entities hosted in the leaving node from local entities
        cleanupDirectedPresences(NodeID.getInstance(nodeID));

        if (!seniorClusterMember && CacheFactory.isSeniorClusterMember()) {
            seniorClusterMember = true;
            ClusterManager.fireMarkedAsSeniorClusterMember();
        }
        cleanupNode(NodeID.getInstance(nodeID));
        
        // Remove traces of directed presences sent from local entities to handlers that no longer exist.
        // At this point c2s sessions are gone from the routing table so we can identify expired sessions
        XMPPServer.getInstance().getPresenceUpdateHandler().removedExpiredPresences();
    }
    // Delete nodeID instance (release from memory)
    NodeID.deleteInstance(nodeID);
    clusterNodesInfo.remove(event.getMember().getUuid()); 
}
 
开发者ID:igniterealtime,项目名称:Openfire,代码行数:30,代码来源:ClusterListener.java

示例3: leaveCluster

import org.jivesoftware.openfire.cluster.ClusterManager; //导入方法依赖的package包/类
private synchronized void leaveCluster() {
if (isDone()) { // not a cluster member
	return;
}
      seniorClusterMember = false;
      // Clean up all traces. This will set all remote sessions as unavailable
      List<NodeID> nodeIDs = new ArrayList<NodeID>(nodeSessions.keySet());

      // Trigger event. Wait until the listeners have processed the event. Caches will be populated
      // again with local content.
      ClusterManager.fireLeftCluster();

      if (!XMPPServer.getInstance().isShuttingDown()) {
          for (NodeID key : nodeIDs) {
              // Clean up directed presences sent from entities hosted in the leaving node to local entities
              // Clean up directed presences sent to entities hosted in the leaving node from local entities
              cleanupDirectedPresences(key);
              // Clean up no longer valid sessions
              cleanupPresences(key);
          }
          // Remove traces of directed presences sent from local entities to handlers that no longer exist
          // At this point c2s sessions are gone from the routing table so we can identify expired sessions
          XMPPServer.getInstance().getPresenceUpdateHandler().removedExpiredPresences();
      }
      logger.info("Left cluster as node: " + cluster.getLocalMember().getUuid());
      done = true;
  }
 
开发者ID:idwanglu2010,项目名称:openfire,代码行数:28,代码来源:ClusterListener.java

示例4: memberRemoved

import org.jivesoftware.openfire.cluster.ClusterManager; //导入方法依赖的package包/类
public void memberRemoved(MembershipEvent event) {
       byte[] nodeID = StringUtils.getBytes(event.getMember().getUuid());

       if (event.getMember().localMember()) {
           logger.info("Leaving cluster: " + nodeID);
           // This node may have realized that it got kicked out of the cluster
           leaveCluster();
       } else {
           // Trigger event that a node left the cluster
           ClusterManager.fireLeftCluster(nodeID);

           // Clean up directed presences sent from entities hosted in the leaving node to local entities
           // Clean up directed presences sent to entities hosted in the leaving node from local entities
           cleanupDirectedPresences(NodeID.getInstance(nodeID));

           if (!seniorClusterMember && CacheFactory.isSeniorClusterMember()) {
               seniorClusterMember = true;
               ClusterManager.fireMarkedAsSeniorClusterMember();
           }

           if (CacheFactory.isSeniorClusterMember()) {
               cleanupNode(NodeID.getInstance(nodeID));
           }
           // Remove traces of directed presences sent from local entities to handlers that no longer exist.
           // At this point c2s sessions are gone from the routing table so we can identify expired sessions
           XMPPServer.getInstance().getPresenceUpdateHandler().removedExpiredPresences();
       }
       // Delete nodeID instance (release from memory)
       NodeID.deleteInstance(nodeID);
       clusterNodesInfo.remove(event.getMember().getUuid()); 
}
 
开发者ID:idwanglu2010,项目名称:openfire,代码行数:32,代码来源:ClusterListener.java

示例5: memberLeft

import org.jivesoftware.openfire.cluster.ClusterManager; //导入方法依赖的package包/类
public void memberLeft(MemberEvent memberEvent) {
    byte[] nodeID = memberEvent.getMember().getUid().toByteArray();

    if (memberEvent.isLocal()) {
        Log.info("Leaving cluster");
        // This node may have realized that it got kicked out of the cluster
        seniorClusterMember = false;
        // Clean up all traces. This will set all remote sessions as unavailable
        List<NodeID> nodeIDs = new ArrayList<NodeID>(nodeSessions.keySet());

        // Revert cluster caches to local caches
        CacheFactory.leftCluster();
        // Trigger event. Wait until the listeners have processed the event. Caches will be populated
        // again with local content.
        ClusterManager.fireLeftCluster();

        if (!XMPPServer.getInstance().isShuttingDown()) {
            for (NodeID key : nodeIDs) {
                // Clean up directed presences sent from entites hosted in the leaving node to local entities
                // Clean up directed presences sent to entites hosted in the leaving node from local entities
                cleanupDirectedPresences(key);
                // Clean up no longer valid sessions
                cleanupPresences(key);
            }
            // Remove traces of directed presences sent from local entities to handlers that no longer exist
            // At this point c2s sessions are gone from the routing table so we can identify expired sessions
            XMPPServer.getInstance().getPresenceUpdateHandler().removedExpiredPresences();
        }

        // Mark that we are done with the clean up
        done = true;
    }
    else {
        // Trigger event that a node left the cluster
        ClusterManager.fireLeftCluster(nodeID);

        // Clean up directed presences sent from entites hosted in the leaving node to local entities
        // Clean up directed presences sent to entites hosted in the leaving node from local entities
        cleanupDirectedPresences(NodeID.getInstance(nodeID));

        if (!seniorClusterMember && CacheFactory.isSeniorClusterMember()) {
            seniorClusterMember = true;
            ClusterManager.fireMarkedAsSeniorClusterMember();
        }

        if (CacheFactory.isSeniorClusterMember()) {
            cleanupNode(NodeID.getInstance(nodeID));
        }
        // Remove traces of directed presences sent from local entities to handlers that no longer exist.
        // At this point c2s sessions are gone from the routing table so we can identify expired sessions
        XMPPServer.getInstance().getPresenceUpdateHandler().removedExpiredPresences();
    }
    // Delete nodeID instance (release from memory)
    NodeID.deleteInstance(nodeID);
}
 
开发者ID:coodeer,项目名称:g3server,代码行数:56,代码来源:ClusterListener.java

示例6: memberLeft

import org.jivesoftware.openfire.cluster.ClusterManager; //导入方法依赖的package包/类
public void memberLeft(MemberEvent memberEvent) {
    byte[] nodeID = memberEvent.getMember().getUid().toByteArray();

    if (memberEvent.isLocal()) {
        Log.info("Leaving cluster");
        // This node may have realized that it got kicked out of the cluster
        seniorClusterMember = false;
        // Clean up all traces. This will set all remote sessions as unavailable
        List<NodeID> nodeIDs = new ArrayList<NodeID>(nodeSessions.keySet());

        // Trigger event. Wait until the listeners have processed the event. Caches will be populated
        // again with local content.
        ClusterManager.fireLeftCluster();

        if (!XMPPServer.getInstance().isShuttingDown()) {
            for (NodeID key : nodeIDs) {
                // Clean up directed presences sent from entites hosted in the leaving node to local entities
                // Clean up directed presences sent to entites hosted in the leaving node from local entities
                cleanupDirectedPresences(key);
                // Clean up no longer valid sessions
                cleanupPresences(key);
            }
            // Remove traces of directed presences sent from local entities to handlers that no longer exist
            // At this point c2s sessions are gone from the routing table so we can identify expired sessions
            XMPPServer.getInstance().getPresenceUpdateHandler().removedExpiredPresences();
        }

        // Mark that we are done with the clean up
        done = true;
    }
    else {
        // Trigger event that a node left the cluster
        ClusterManager.fireLeftCluster(nodeID);

        // Clean up directed presences sent from entites hosted in the leaving node to local entities
        // Clean up directed presences sent to entites hosted in the leaving node from local entities
        cleanupDirectedPresences(NodeID.getInstance(nodeID));

        if (!seniorClusterMember && CacheFactory.isSeniorClusterMember()) {
            seniorClusterMember = true;
            ClusterManager.fireMarkedAsSeniorClusterMember();
        }

        if (CacheFactory.isSeniorClusterMember()) {
            cleanupNode(NodeID.getInstance(nodeID));
        }
        // Remove traces of directed presences sent from local entities to handlers that no longer exist.
        // At this point c2s sessions are gone from the routing table so we can identify expired sessions
        XMPPServer.getInstance().getPresenceUpdateHandler().removedExpiredPresences();
    }
    // Delete nodeID instance (release from memory)
    NodeID.deleteInstance(nodeID);
}
 
开发者ID:idwanglu2010,项目名称:openfire,代码行数:54,代码来源:ClusterListener.java


注:本文中的org.jivesoftware.openfire.cluster.ClusterManager.fireLeftCluster方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。