This commit is contained in:
Redkale
2019-01-19 16:28:44 +08:00
parent fea34863e3
commit a321b41699

View File

@@ -59,7 +59,11 @@ public abstract class WebSocketNode {
protected Semaphore semaphore;
private int tryAcquireSeconds = 12;
public void init(AnyValue conf) {
this.tryAcquireSeconds = Integer.getInteger("WebSocketNode.tryAcquireSeconds", 12);
if (sncpNodeAddresses != null && "memory".equals(sncpNodeAddresses.getType())) {
sncpNodeAddresses.initValueType(InetSocketAddress.class);
}
@@ -775,7 +779,7 @@ public abstract class WebSocketNode {
protected boolean tryAcquireSemaphore() {
if (this.semaphore == null) return true;
try {
return this.semaphore.tryAcquire(6, TimeUnit.SECONDS);
return this.semaphore.tryAcquire(tryAcquireSeconds, TimeUnit.SECONDS);
} catch (Exception e) {
return false;
}