@ -58,6 +58,10 @@ public class RedisConnection implements RedisCommands {
updateChannel(channel);
lastUsageTime = System.currentTimeMillis();
}
protected RedisConnection() {
redisClient = null;
public static <C extends RedisConnection> C getFrom(Channel channel) {
return (C) channel.attr(RedisConnection.CONNECTION).get();
@ -49,6 +49,19 @@ public class AsyncSemaphore {
public boolean tryAcquire() {
synchronized (this) {
if (counter == 0) {
return false;
if (counter > 0) {
counter--;
return true;
throw new IllegalStateException();
public void acquire(Runnable listener) {
boolean run = false;