com.hazelcast.core.IList Java Examples

The following examples show how to use com.hazelcast.core.IList. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: MessageServiceImpl.java    From java-11-examples with Apache License 2.0 5 votes vote down vote up
@Override
public void publishMessage(String topic, String message) {
    IList<String> messages = messageServiceCaches.get(topic);
    if (messages == null) {
        messages = hazelcastInstance.getList(topic);
        messageServiceCaches.put(topic, messages);
    }
    messages.add(message);
}
 
Example #2
Source File: MessageServiceImpl.java    From java-11-examples with Apache License 2.0 5 votes vote down vote up
@Override
public MessageServiceSubscription subscribe(String topic, MessageServiceListener listener) {
    IList<String> messages = messageServiceCaches.get(topic);
    if (messages == null) {
        messages = hazelcastInstance.getList(topic);
        messageServiceCaches.put(topic, messages);
    }
    ItemListenerImpl itemListener = new ItemListenerImpl(listener);
    String subscriptionId = messages.addItemListener(itemListener, true);
    return new MessageServiceSubscriptionImpl(topic, subscriptionId);
}
 
Example #3
Source File: MessageServiceImpl.java    From java-11-examples with Apache License 2.0 5 votes vote down vote up
@Override
public void unSubscribe(MessageServiceSubscription messageServiceSubscription) {
    IList<String> messages = messageServiceCaches.get(messageServiceSubscription.getTopic());
    if (messages != null) {
        messages.removeItemListener(messageServiceSubscription.getId());
    }
}
 
Example #4
Source File: HazelcastDistributedListProvider.java    From attic-stratos with Apache License 2.0 5 votes vote down vote up
public void removeList(String name) {
    DistList list = listMap.get(name);
    if (list != null) {
        IList ilist = (IList) list;
        ilist.removeItemListener(list.getListenerId());
        listMap.remove(list);
        ilist.destroy();
    }
}
 
Example #5
Source File: HazelcastDistributedObjectProvider.java    From attic-stratos with Apache License 2.0 5 votes vote down vote up
/**
 * Remove a list from the object provider.
 *
 * @param name
 */
@Override
public void removeList(String name) {
    if (listsMap.containsKey(name)) {
        if (isClustered()) {
            IList list = (IList) listsMap.get(name);
            listProvider.removeList(name);
            list.destroy();
        }
        listsMap.remove(name);
    }
}
 
Example #6
Source File: WebConfigurerTest.java    From flair-engine with Apache License 2.0 4 votes vote down vote up
@Override
public <E> IList<E> getList(String s) {
    return null;
}