use of org.redisson.pubsub.TransferListener in project redisson by redisson.
the class MasterSlaveConnectionManager method subscribe.
public RFuture<PubSubConnectionEntry> subscribe(final Codec codec, final String channelName, final RedisPubSubListener<?> listener) {
final AsyncSemaphore lock = getSemaphore(channelName);
final RPromise<PubSubConnectionEntry> result = newPromise();
lock.acquire(new Runnable() {
@Override
public void run() {
RFuture<PubSubConnectionEntry> future = subscribe(codec, channelName, listener, lock);
future.addListener(new TransferListener<PubSubConnectionEntry>(result));
}
});
return result;
}
use of org.redisson.pubsub.TransferListener in project redisson by redisson.
the class MasterSlaveConnectionManager method psubscribe.
@Override
public RFuture<PubSubConnectionEntry> psubscribe(final String channelName, final Codec codec, final RedisPubSubListener<?> listener) {
final AsyncSemaphore lock = getSemaphore(channelName);
final RPromise<PubSubConnectionEntry> result = newPromise();
lock.acquire(new Runnable() {
@Override
public void run() {
RFuture<PubSubConnectionEntry> future = psubscribe(channelName, codec, listener, lock);
future.addListener(new TransferListener<PubSubConnectionEntry>(result));
}
});
return result;
}
Aggregations