/* Log the number of fds used before and after a test is run. Verifies
* we are freeing resources correctly. Unfortunately this only works
* on unix systems (the only place sun has implemented as part of the
* mgmt bean api).
*/
UnixOperatingSystemMXBean unixos =
(UnixOperatingSystemMXBean) osMbean;
long initialFdCount = unixos.getOpenFileDescriptorCount();
VerifyClientCleanup threads[] = new VerifyClientCleanup[threadCount];
for (int i = 0; i < threads.length; i++) {
threads[i] = new VerifyClientCleanup("VCC" + i, clientCount);
threads[i].start();
}
for (int i = 0; i < threads.length; i++) {
threads[i].join(CONNECTION_TIMEOUT);
assertTrue(threads[i].current == threads[i].count);
}
// if this fails it means we are not cleaning up after the closed
// sessions.
assertTrue("open fds after test are not significantly higher than before",
unixos.getOpenFileDescriptorCount() <= initialFdCount + 10);
}