Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,13 @@ public void testMonitoredCachePurgesClosedSockets() throws InterruptedException
cache.addSocket(socket);
Assert.assertEquals("1 socket in cache", 1, cache.getOpenSocketCount());
socket.close();
Thread.sleep(20);

// Wait for the MonitoredCache task to clean up the socket, up to 500ms.
for (int i = 0; cache.getOpenSocketCount() > 0 && i < 10; i++) {
Thread.sleep(50);
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should this be 500? Comment says 500 milliseconds...

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This waits 50ms up to 10 times, for a possible max of 500ms waiting.

}

// Ensure that the socket was removed from the cache.
Assert.assertEquals("0 socket in cache", 0, cache.getOpenSocketCount());
}

Expand Down
Loading