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;
}
}
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);
}
}
}
Aggregations