Java 类com.hazelcast.core.ItemEventType 实例源码

项目:health-and-care-developer-network    文件:QueueItemListenerManager.java   
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));
            }
        }
    }
}
项目:Camel    文件:HazelcastListConsumerTest.java   
@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);
}
项目:Camel    文件:HazelcastListConsumerTest.java   
@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);
}
项目:Camel    文件:HazelcastSetConsumerTest.java   
@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);
}
项目:Camel    文件:HazelcastSetConsumerTest.java   
@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);
}
项目:Camel    文件:HazelcastQueueConsumerTest.java   
@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);
}
项目:Camel    文件:HazelcastQueueConsumerTest.java   
@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);
}
项目:hazelcast-archive    文件:QueueItemListenerManager.java   
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())));
            }
        }
    }
}
项目:hazelcast-archive    文件:DataAwareItemEvent.java   
public DataAwareItemEvent(String name, ItemEventType itemEventType, Data itemData) {
    super(name, itemEventType, null);
    this.itemData = itemData;
}
项目:health-and-care-developer-network    文件:DataAwareItemEvent.java   
public DataAwareItemEvent(String name, ItemEventType itemEventType, Data itemData, Member member) {
    super(name, itemEventType, null, member);
    this.itemData = itemData;
}