/** * return the total number of client connections that are alive * to this server */ public int getNumAliveConnections() { int numAliveConnections = 0; if (serverCnxnFactory != null) { numAliveConnections += serverCnxnFactory.getNumAliveConnections(); } if (secureServerCnxnFactory != null) { numAliveConnections += secureServerCnxnFactory.getNumAliveConnections(); } return numAliveConnections; }
/** * return the total number of client connections that are alive * to this server */ public int getNumAliveConnections() { return serverCnxnFactory.getNumAliveConnections(); }
Iterable<ServerCnxn> connections = serverFactory.getConnections(); Assert.assertEquals("Mismatch in number of live connections!", 1, serverFactory.getNumAliveConnections()); for (ServerCnxn serverCnxn : connections) { serverCnxn.sendCloseSession(); while (serverFactory.getNumAliveConnections() != 0) { Thread.sleep(1000); timeout += 1000;
@Override public double get() { ServerCnxnFactory cnxFactory = zkServer.getServerCnxnFactory(); if (cnxFactory != null) { return cnxFactory.getNumAliveConnections(); } else { return -1; } } }).register();