|
@@ -63,6 +63,7 @@ import java.util.concurrent.BlockingQueue;
|
|
|
import java.util.concurrent.ConcurrentHashMap;
|
|
|
import java.util.concurrent.LinkedBlockingQueue;
|
|
|
import java.util.concurrent.atomic.AtomicInteger;
|
|
|
+import java.util.concurrent.atomic.AtomicLong;
|
|
|
|
|
|
import javax.security.sasl.Sasl;
|
|
|
import javax.security.sasl.SaslException;
|
|
@@ -1219,6 +1220,7 @@ public abstract class Server {
|
|
|
if (channel.isOpen()) {
|
|
|
IOUtils.cleanup(null, channel);
|
|
|
}
|
|
|
+ connectionManager.droppedConnections.getAndIncrement();
|
|
|
continue;
|
|
|
}
|
|
|
key.attach(c); // so closeCurrentConnection can get the object
|
|
@@ -3088,6 +3090,16 @@ public abstract class Server {
|
|
|
return null;
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * The number of RPC connections dropped due to
|
|
|
+ * too many connections.
|
|
|
+ * @return the number of dropped rpc connections
|
|
|
+ */
|
|
|
+ public long getNumDroppedConnections() {
|
|
|
+ return connectionManager.getDroppedConnections();
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* The number of rpc calls in the queue.
|
|
|
* @return The number of rpc calls in the queue.
|
|
@@ -3205,7 +3217,8 @@ public abstract class Server {
|
|
|
}
|
|
|
|
|
|
private class ConnectionManager {
|
|
|
- final private AtomicInteger count = new AtomicInteger();
|
|
|
+ final private AtomicInteger count = new AtomicInteger();
|
|
|
+ final private AtomicLong droppedConnections = new AtomicLong();
|
|
|
final private Set<Connection> connections;
|
|
|
/* Map to maintain the statistics per User */
|
|
|
final private Map<String, Integer> userToConnectionsMap;
|
|
@@ -3292,6 +3305,11 @@ public abstract class Server {
|
|
|
return userToConnectionsMap;
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ long getDroppedConnections() {
|
|
|
+ return droppedConnections.get();
|
|
|
+ }
|
|
|
+
|
|
|
int size() {
|
|
|
return count.get();
|
|
|
}
|