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


Java ItemEventType类代码示例

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


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

示例1: notifyListeners

import com.hazelcast.core.ItemEventType; //导入依赖的package包/类
public void notifyListeners(Packet packet) {
    List<ItemListenerHolder> list = queueItemListeners.get(packet.getName());
    if (list != null) {
        for (ItemListenerHolder listenerHolder : list) {
            ItemListener<Object> listener = listenerHolder.listener;
            Boolean added = (Boolean) toObject(packet.getValue());
            if (added) {
                listener.itemAdded(new DataAwareItemEvent(packet.getName(), ItemEventType.ADDED,
                                                            listenerHolder.includeValue ? new Data(packet.getKey()) : null, null));
            } else {
                listener.itemRemoved(new DataAwareItemEvent(packet.getName(), ItemEventType.REMOVED,
                                                            listenerHolder.includeValue ? new Data(packet.getKey()) : null, null));
            }
        }
    }
}
 
开发者ID:health-and-care-developer-network,项目名称:health-and-care-developer-network,代码行数:17,代码来源:QueueItemListenerManager.java

示例2: add

import com.hazelcast.core.ItemEventType; //导入依赖的package包/类
@Test
@SuppressWarnings("unchecked")
public void add() throws InterruptedException {
    MockEndpoint out = getMockEndpoint("mock:added");
    out.expectedMessageCount(1);

    final ItemEvent<String> event = new ItemEvent<String>("mm", ItemEventType.ADDED, "foo", null);
    argument.getValue().itemAdded(event);

    assertMockEndpointsSatisfied(2000, TimeUnit.MILLISECONDS);

    this.checkHeaders(out.getExchanges().get(0).getIn().getHeaders(), HazelcastConstants.ADDED);
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:14,代码来源:HazelcastListConsumerTest.java

示例3: remove

import com.hazelcast.core.ItemEventType; //导入依赖的package包/类
@Test
@SuppressWarnings("unchecked")
public void remove() throws InterruptedException {
    MockEndpoint out = getMockEndpoint("mock:removed");
    out.expectedMessageCount(1);

    final ItemEvent<String> event = new ItemEvent<String>("mm", ItemEventType.REMOVED, "foo", null);
    argument.getValue().itemRemoved(event);

    assertMockEndpointsSatisfied(2000, TimeUnit.MILLISECONDS);
    this.checkHeaders(out.getExchanges().get(0).getIn().getHeaders(), HazelcastConstants.REMOVED);
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:13,代码来源:HazelcastListConsumerTest.java

示例4: add

import com.hazelcast.core.ItemEventType; //导入依赖的package包/类
@Test
@SuppressWarnings("unchecked")
public void add() throws InterruptedException {
    MockEndpoint out = getMockEndpoint("mock:added");
    out.expectedMessageCount(1);

    final ItemEvent<String> event = new ItemEvent<String>("foo", ItemEventType.ADDED, "foo", null);
    argument.getValue().itemAdded(event);


    assertMockEndpointsSatisfied(2000, TimeUnit.MILLISECONDS);

    this.checkHeaders(out.getExchanges().get(0).getIn().getHeaders(), HazelcastConstants.ADDED);
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:15,代码来源:HazelcastQueueConsumerTest.java

示例5: remove

import com.hazelcast.core.ItemEventType; //导入依赖的package包/类
@Test
@SuppressWarnings("unchecked")
public void remove() throws InterruptedException {
    MockEndpoint out = getMockEndpoint("mock:removed");
    out.expectedMessageCount(1);

    final ItemEvent<String> event = new ItemEvent<String>("foo", ItemEventType.REMOVED, "foo", null);
    argument.getValue().itemRemoved(event);

    assertMockEndpointsSatisfied(2000, TimeUnit.MILLISECONDS);
    this.checkHeaders(out.getExchanges().get(0).getIn().getHeaders(), HazelcastConstants.REMOVED);
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:13,代码来源:HazelcastQueueConsumerTest.java

示例6: notifyListeners

import com.hazelcast.core.ItemEventType; //导入依赖的package包/类
public void notifyListeners(Packet packet) {
    List<ItemListener> list = queueItemListeners.get(packet.getName());
    if (list != null) {
        for (ItemListener<Object> listener : list) {
            Boolean added = (Boolean) toObject(packet.getValue());
            if (added) {
                listener.itemAdded(new DataAwareItemEvent(packet.getName(), ItemEventType.ADDED, new Data(packet.getKey())));
            } else {
                listener.itemRemoved(new DataAwareItemEvent(packet.getName(), ItemEventType.ADDED, new Data(packet.getKey())));
            }
        }
    }
}
 
开发者ID:mdogan,项目名称:hazelcast-archive,代码行数:14,代码来源:QueueItemListenerManager.java

示例7: DataAwareItemEvent

import com.hazelcast.core.ItemEventType; //导入依赖的package包/类
public DataAwareItemEvent(String name, ItemEventType itemEventType, Data itemData) {
    super(name, itemEventType, null);
    this.itemData = itemData;
}
 
开发者ID:mdogan,项目名称:hazelcast-archive,代码行数:5,代码来源:DataAwareItemEvent.java

示例8: DataAwareItemEvent

import com.hazelcast.core.ItemEventType; //导入依赖的package包/类
public DataAwareItemEvent(String name, ItemEventType itemEventType, Data itemData, Member member) {
    super(name, itemEventType, null, member);
    this.itemData = itemData;
}
 
开发者ID:health-and-care-developer-network,项目名称:health-and-care-developer-network,代码行数:5,代码来源:DataAwareItemEvent.java


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