Signed-off-by: luoshi <luoshi@qmth.com.cn>
@@ -10,4 +10,6 @@ public interface Semaphore {
boolean tryAcquire();
void release();
+
+ boolean isAvailable();
}
@@ -101,6 +101,11 @@ public class MemoryConcurrentService implements ConcurrentService {
public void release() {
se.release();
+ @Override
+ public boolean isAvailable() {
+ return se.availablePermits() > 0;
+ }
};
});
@@ -78,6 +78,11 @@ public class RedisConcurrentService implements ConcurrentService, RedisConstant
semaphore.release();
+ return semaphore.availablePermits() > 0;