Refactoring

pull/727/head
Nikita 8 years ago
parent 8028f72b66
commit b7da522b74

@ -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;

Loading…
Cancel
Save