• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java MapEvent类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: onMapEvent

import com.tangosol.util.MapEvent; //导入依赖的package包/类
@Override
public void onMapEvent(MapEvent event) {

          LOG.trace("got event: {}, type: {}", event, event.getClass().getName());
          LOG.trace("got entry: {} and source: {}", event.getOldEntry(), event.getSource());
	
       if (event instanceof CacheEvent && ((CacheEvent) event).isSynthetic()) {
           //LOG.trace("Skipping synthetic event: {}", event);
           return;
       }

       //if (!context.isKeyOwned(evt.getKey())) {
       //    LOGGER.trace("Skipping redistribution event: {}", evt);
       //    return;
       //}
	
	trigger.process(new SimpleMapEntry(event.getKey(), event.getNewValue(), event.getOldValue()));
}
 
开发者ID:dsukhoroslov,项目名称:bagri,代码行数:19,代码来源:ReplicatedCachePopulator.java


示例2: simuateCacheInserts

import com.tangosol.util.MapEvent; //导入依赖的package包/类
private void simuateCacheInserts(Cache<Object, Object> cache) {
    MapListener mapListener = mapListeners.get(cache);
    if (mapListener != null) {
        if (cache instanceof CacheWrapper) {
            Cache wrapped = ((CacheWrapper) cache).getWrappedCache();
            if (wrapped instanceof ClusteredCache) {
                ClusteredCache clusteredCache = (ClusteredCache) wrapped;
                for (Map.Entry entry : cache.entrySet()) {
                    MapEvent event = new MapEvent(clusteredCache.map, MapEvent.ENTRY_INSERTED, entry.getKey(), null,
                            entry.getValue());
                    mapListener.entryInserted(event);
                }
            }
        }
    }
}
 
开发者ID:coodeer,项目名称:g3server,代码行数:17,代码来源:ClusterListener.java


示例3: entryInserted

import com.tangosol.util.MapEvent; //导入依赖的package包/类
public void entryInserted(MapEvent mapEvent) {
    byte[] nodeID = getNodeID(mapEvent, false);
    // Ignore events origintated from this JVM
    if (!XMPPServer.getInstance().getNodeID().equals(nodeID)) {
        // Check if the directed presence was sent to an entity hosted by this JVM
        RoutingTable routingTable = XMPPServer.getInstance().getRoutingTable();
        String sender = mapEvent.getKey().toString();
        Collection<String> handlers = new HashSet<String>();
        for (JID handler : getHandlers(mapEvent)) {
            if (routingTable.isLocalRoute(handler)) {
                // Keep track of the remote sender and local handler that got the directed presence
                handlers.addAll(getReceivers(mapEvent, handler));
            }
        }
        if (!handlers.isEmpty()) {
            Map<String, Collection<String>> senders = nodePresences.get(NodeID.getInstance(nodeID));
            if (senders == null) {
                senders = new ConcurrentHashMap<String, Collection<String>>();
                nodePresences.put(NodeID.getInstance(nodeID), senders);
            }
            senders.put(sender, handlers);
        }
    }
}
 
开发者ID:coodeer,项目名称:g3server,代码行数:25,代码来源:ClusterListener.java


示例4: handleMapEvent

import com.tangosol.util.MapEvent; //导入依赖的package包/类
void handleMapEvent(MapEvent mapEvent, boolean removal) {
    NodeID nodeID = getNodeID(mapEvent, removal);
    //ignore items which this node has added
    if (!XMPPServer.getInstance().getNodeID().equals(nodeID)) {
        Set<String> sessionJIDS = clusterListener.lookupJIDList(nodeID, cacheName);
        if (removal) {
            sessionJIDS.remove(mapEvent.getKey().toString());
        }
        else {
            sessionJIDS.add(mapEvent.getKey().toString());
        }
    }
}
 
开发者ID:coodeer,项目名称:g3server,代码行数:14,代码来源:CacheListener.java


示例5: entryUpdated

import com.tangosol.util.MapEvent; //导入依赖的package包/类
public void entryUpdated(MapEvent mapEvent) {
    byte[] nodeID = getNodeID(mapEvent, false);
    // Ignore events origintated from this JVM
    if (nodeID != null && !XMPPServer.getInstance().getNodeID().equals(nodeID)) {
        // Check if the directed presence was sent to an entity hosted by this JVM
        RoutingTable routingTable = XMPPServer.getInstance().getRoutingTable();
        String sender = mapEvent.getKey().toString();
        Collection<String> handlers = new HashSet<String>();
        for (JID handler : getHandlers(mapEvent)) {
            if (routingTable.isLocalRoute(handler)) {
                // Keep track of the remote sender and local handler that got the directed presence
                handlers.addAll(getReceivers(mapEvent, handler));
            }
        }
        Map<String, Collection<String>> senders = nodePresences.get(NodeID.getInstance(nodeID));
        if (senders == null) {
            senders = new ConcurrentHashMap<String, Collection<String>>();
            nodePresences.put(NodeID.getInstance(nodeID), senders);
        }
        if (!handlers.isEmpty()) {
            senders.put(sender, handlers);
        }
        else {
            // Remove any traces of the sender since no directed presence was sent to this JVM
            senders.remove(sender);
        }
    }
}
 
开发者ID:coodeer,项目名称:g3server,代码行数:29,代码来源:ClusterListener.java


示例6: entryDeleted

import com.tangosol.util.MapEvent; //导入依赖的package包/类
public void entryDeleted(MapEvent mapEvent) {
    if (mapEvent.getNewValue() == null && ((Collection)mapEvent.getOldValue()).isEmpty()) {
        // Nothing to remove
        return;
    }
    byte[] nodeID = getNodeID(mapEvent, true);
    if (!XMPPServer.getInstance().getNodeID().equals(nodeID)) {
        String sender = mapEvent.getKey().toString();
        nodePresences.get(NodeID.getInstance(nodeID)).remove(sender);
    }
}
 
开发者ID:coodeer,项目名称:g3server,代码行数:12,代码来源:ClusterListener.java


示例7: getNodeID

import com.tangosol.util.MapEvent; //导入依赖的package包/类
byte[] getNodeID(MapEvent mapEvent, boolean removal) {
    Object value = removal ? mapEvent.getOldValue() : mapEvent.getNewValue();
    Collection<DirectedPresence> directedPresences = (Collection<DirectedPresence>) value;
    if (directedPresences.isEmpty()) {
        Log.warn("ClusteringListener - Found empty directed presences for sender: " + mapEvent.getKey());
        return null;
    }
    return directedPresences.iterator().next().getNodeID();
}
 
开发者ID:coodeer,项目名称:g3server,代码行数:10,代码来源:ClusterListener.java


示例8: getHandlers

import com.tangosol.util.MapEvent; //导入依赖的package包/类
Collection<JID> getHandlers(MapEvent mapEvent) {
    Object value = mapEvent.getNewValue();
    Collection<JID> answer = new ArrayList<JID>();
    for (DirectedPresence directedPresence : (Collection<DirectedPresence>)value) {
        answer.add(directedPresence.getHandler());
    }
    return answer;
}
 
开发者ID:coodeer,项目名称:g3server,代码行数:9,代码来源:ClusterListener.java


示例9: getReceivers

import com.tangosol.util.MapEvent; //导入依赖的package包/类
Set<String> getReceivers(MapEvent mapEvent, JID handler) {
    Object value = mapEvent.getNewValue();
    for (DirectedPresence directedPresence : (Collection<DirectedPresence>)value) {
        if (directedPresence.getHandler().equals(handler)) {
            return directedPresence.getReceivers();
        }
    }
    return Collections.emptySet();
}
 
开发者ID:coodeer,项目名称:g3server,代码行数:10,代码来源:ClusterListener.java


示例10: onMapEvent

import com.tangosol.util.MapEvent; //导入依赖的package包/类
@Override
protected void onMapEvent(MapEvent mapEvent) {
    latch.countDown();
}
 
开发者ID:datalorax,项目名称:datagrids,代码行数:5,代码来源:CountdownMapListener.java


示例11: entryInserted

import com.tangosol.util.MapEvent; //导入依赖的package包/类
public void entryInserted(MapEvent mapEvent) {
    handleMapEvent(mapEvent, false);
}
 
开发者ID:coodeer,项目名称:g3server,代码行数:4,代码来源:CacheListener.java


示例12: entryUpdated

import com.tangosol.util.MapEvent; //导入依赖的package包/类
public void entryUpdated(MapEvent mapEvent) {
    handleMapEvent(mapEvent, false);
}
 
开发者ID:coodeer,项目名称:g3server,代码行数:4,代码来源:CacheListener.java


示例13: entryDeleted

import com.tangosol.util.MapEvent; //导入依赖的package包/类
public void entryDeleted(MapEvent mapEvent) {
    handleMapEvent(mapEvent, true);
}
 
开发者ID:coodeer,项目名称:g3server,代码行数:4,代码来源:CacheListener.java



注:本文中的com.tangosol.util.MapEvent类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java Error类代码示例发布时间:2022-05-22
下一篇:
Java SnsPostListener类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap