• 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏吧

Java MemberEvent类的典型用法和代码示例

java 2次浏览

本文整理汇总了Java中com.tangosol.net.MemberEvent的典型用法代码示例。如果您正苦于以下问题:Java MemberEvent类的具体用法?Java MemberEvent怎么用?Java MemberEvent使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。

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

示例1: memberLeft

点赞 2

import com.tangosol.net.MemberEvent; //导入依赖的package包/类
/**
 * @param event Member event
 */
@Override
public void memberLeft(MemberEvent event) {
    log.trace("Cache member left: {}", event);

    Object ctx = event.getService().getUserContext();
    log.debug("memberLeft; got Context: {}", ctx);

    if (ctx != null) {
        PopulationContext popCtx = (PopulationContext) ctx;
        popCtx.leaveService();
    }
}
 

开发者ID:dsukhoroslov,
项目名称:bagri,
代码行数:16,
代码来源:CachePopulationListener.java

示例2: memberJoined

点赞 2

import com.tangosol.net.MemberEvent; //导入依赖的package包/类
public void memberJoined(MemberEvent memberEvent) {
    if (memberEvent.isLocal()) {
        done = false;
        // We left and re-joined the cluster
        Log.info("Rejoining cluster as node: " + new UID(CacheFactory.getClusterMemberID()) + ". Senior Member: " +
                (CacheFactory.isSeniorClusterMember() ? "YES" : "NO"));
        // Simulate insert events of existing cache content
        simuateCacheInserts(C2SCache);
        simuateCacheInserts(anonymousC2SCache);
        simuateCacheInserts(S2SCache);
        simuateCacheInserts(componentsCache);
        simuateCacheInserts(componentSessionsCache);
        simuateCacheInserts(multiplexerSessionsCache);
        simuateCacheInserts(incomingServerSessionsCache);
        simuateCacheInserts(directedPresencesCache);
        // Set the new ID of this cluster node
        XMPPServer.getInstance().setNodeID(NodeID.getInstance(CacheFactory.getClusterMemberID()));
        // Trigger events
        ClusterManager.fireJoinedCluster(true);
        if (CacheFactory.isSeniorClusterMember()) {
            seniorClusterMember = true;
            ClusterManager.fireMarkedAsSeniorClusterMember();
        }
    }
    else {
        nodePresences.put(NodeID.getInstance(memberEvent.getMember().getUid().toByteArray()),
                new ConcurrentHashMap<String, Collection<String>>());
        // Trigger event that a new node has joined the cluster
        ClusterManager.fireJoinedCluster(memberEvent.getMember().getUid().toByteArray(), true);
    }
}
 

开发者ID:coodeer,
项目名称:g3server,
代码行数:32,
代码来源:ClusterListener.java

示例3: memberLeaving

点赞 2

import com.tangosol.net.MemberEvent; //导入依赖的package包/类
/**
 * @param event Member event
 */
@Override
public void memberLeaving(MemberEvent event) {
    log.trace("Cache member leaving: {}", event);
}
 

开发者ID:dsukhoroslov,
项目名称:bagri,
代码行数:8,
代码来源:CachePopulationListener.java

示例4: memberLeaving

点赞 2

import com.tangosol.net.MemberEvent; //导入依赖的package包/类
public void memberLeaving(MemberEvent memberEvent) {
    // Ignore
}
 

开发者ID:coodeer,
项目名称:g3server,
代码行数:4,
代码来源:ClusterListener.java

示例5: memberLeft

点赞 2

import com.tangosol.net.MemberEvent; //导入依赖的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

点赞 2

import com.tangosol.net.MemberEvent; //导入依赖的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


版权声明:本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系管理员进行删除。
喜欢 (0)