Search in sources :

Example 1 with SubscribeListener

use of org.redisson.client.SubscribeListener in project redisson by redisson.

the class PubSubConnectionEntry method addSubscribeListener.

private SubscribeListener addSubscribeListener(String channel, PubSubType type) {
    SubscribeListener subscribeListener = new SubscribeListener(channel, type);
    SubscribeListener oldSubscribeListener = subscribeChannelListeners.putIfAbsent(channel, subscribeListener);
    if (oldSubscribeListener != null) {
        return oldSubscribeListener;
    } else {
        conn.addListener(subscribeListener);
        return subscribeListener;
    }
}
Also used : SubscribeListener(org.redisson.client.SubscribeListener)

Example 2 with SubscribeListener

use of org.redisson.client.SubscribeListener in project redisson by redisson.

the class PubSubConnectionEntry method removeListeners.

private void removeListeners(String channel) {
    conn.removeDisconnectListener(channel);
    SubscribeListener s = subscribeChannelListeners.remove(channel);
    conn.removeListener(s);
    Queue<RedisPubSubListener<?>> queue = channelListeners.get(channel);
    if (queue != null) {
        synchronized (queue) {
            channelListeners.remove(channel);
        }
        for (RedisPubSubListener<?> listener : queue) {
            conn.removeListener(listener);
        }
    }
}
Also used : RedisPubSubListener(org.redisson.client.RedisPubSubListener) BaseRedisPubSubListener(org.redisson.client.BaseRedisPubSubListener) SubscribeListener(org.redisson.client.SubscribeListener)

Aggregations

SubscribeListener (org.redisson.client.SubscribeListener)2 BaseRedisPubSubListener (org.redisson.client.BaseRedisPubSubListener)1 RedisPubSubListener (org.redisson.client.RedisPubSubListener)1