Search in sources :

Example 1 with PubSubConnectionEntry

use of org.redisson.connection.PubSubConnectionEntry in project redisson by redisson.

the class RedissonTopic method removeAllListeners.

@Override
public void removeAllListeners() {
    AsyncSemaphore semaphore = commandExecutor.getConnectionManager().getSemaphore(name);
    semaphore.acquireUninterruptibly();
    PubSubConnectionEntry entry = commandExecutor.getConnectionManager().getPubSubEntry(name);
    if (entry == null) {
        semaphore.release();
        return;
    }
    entry.removeAllListeners(name);
    if (!entry.hasListeners(name)) {
        commandExecutor.getConnectionManager().unsubscribe(name, semaphore);
    } else {
        semaphore.release();
    }
}
Also used : PubSubConnectionEntry(org.redisson.connection.PubSubConnectionEntry) AsyncSemaphore(org.redisson.pubsub.AsyncSemaphore)

Example 2 with PubSubConnectionEntry

use of org.redisson.connection.PubSubConnectionEntry in project redisson by redisson.

the class RedissonPatternTopic method removeListener.

@Override
public void removeListener(int listenerId) {
    AsyncSemaphore semaphore = commandExecutor.getConnectionManager().getSemaphore(name);
    semaphore.acquireUninterruptibly();
    PubSubConnectionEntry entry = commandExecutor.getConnectionManager().getPubSubEntry(name);
    if (entry == null) {
        semaphore.release();
        return;
    }
    entry.removeListener(name, listenerId);
    if (!entry.hasListeners(name)) {
        commandExecutor.getConnectionManager().punsubscribe(name, semaphore);
    } else {
        semaphore.release();
    }
}
Also used : PubSubConnectionEntry(org.redisson.connection.PubSubConnectionEntry) AsyncSemaphore(org.redisson.pubsub.AsyncSemaphore)

Example 3 with PubSubConnectionEntry

use of org.redisson.connection.PubSubConnectionEntry in project redisson by redisson.

the class RedissonPatternTopic method removeAllListeners.

@Override
public void removeAllListeners() {
    AsyncSemaphore semaphore = commandExecutor.getConnectionManager().getSemaphore(name);
    semaphore.acquireUninterruptibly();
    PubSubConnectionEntry entry = commandExecutor.getConnectionManager().getPubSubEntry(name);
    if (entry == null) {
        semaphore.release();
        return;
    }
    entry.removeAllListeners(name);
    if (!entry.hasListeners(name)) {
        commandExecutor.getConnectionManager().punsubscribe(name, semaphore);
    } else {
        semaphore.release();
    }
}
Also used : PubSubConnectionEntry(org.redisson.connection.PubSubConnectionEntry) AsyncSemaphore(org.redisson.pubsub.AsyncSemaphore)

Example 4 with PubSubConnectionEntry

use of org.redisson.connection.PubSubConnectionEntry in project redisson by redisson.

the class RedissonPatternTopicReactive method removeListener.

@Override
public void removeListener(int listenerId) {
    AsyncSemaphore semaphore = commandExecutor.getConnectionManager().getSemaphore(name);
    semaphore.acquireUninterruptibly();
    PubSubConnectionEntry entry = commandExecutor.getConnectionManager().getPubSubEntry(name);
    if (entry == null) {
        semaphore.release();
        return;
    }
    entry.removeListener(name, listenerId);
    if (!entry.hasListeners(name)) {
        commandExecutor.getConnectionManager().punsubscribe(name, semaphore);
    } else {
        semaphore.release();
    }
}
Also used : PubSubConnectionEntry(org.redisson.connection.PubSubConnectionEntry) AsyncSemaphore(org.redisson.pubsub.AsyncSemaphore)

Example 5 with PubSubConnectionEntry

use of org.redisson.connection.PubSubConnectionEntry in project redisson by redisson.

the class RedissonTopicReactive method removeListener.

@Override
public void removeListener(int listenerId) {
    AsyncSemaphore semaphore = commandExecutor.getConnectionManager().getSemaphore(name);
    semaphore.acquireUninterruptibly();
    PubSubConnectionEntry entry = commandExecutor.getConnectionManager().getPubSubEntry(name);
    if (entry == null) {
        semaphore.release();
        return;
    }
    entry.removeListener(name, listenerId);
    if (!entry.hasListeners(name)) {
        commandExecutor.getConnectionManager().unsubscribe(name, semaphore);
    } else {
        semaphore.release();
    }
}
Also used : PubSubConnectionEntry(org.redisson.connection.PubSubConnectionEntry) AsyncSemaphore(org.redisson.pubsub.AsyncSemaphore)

Aggregations

PubSubConnectionEntry (org.redisson.connection.PubSubConnectionEntry)8 AsyncSemaphore (org.redisson.pubsub.AsyncSemaphore)8