lichaojacobs commented on a change in pull request #2775: URL: https://github.com/apache/hadoop/pull/2775#discussion_r609454979
########## File path: hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-jobclient/src/test/java/org/apache/hadoop/mapred/pipes/TestPipeApplication.java ########## @@ -455,6 +460,96 @@ public void testPipesPartitioner() { assertEquals(3, partitioner.getPartition(iw, new Text("test"), 2)); } + @Test + public void testSocketCleaner() throws Exception { + ServerSocket serverSocket = setupServerSocket(); + SocketCleaner cleaner = setupCleaner(serverSocket); + // mock ping thread, connect to server socket per second. + int expectedClosedCount = 5; + for (int i = 0; i < expectedClosedCount; i++) { + try { + Thread.sleep(1000); + Socket clientSocket = new Socket(serverSocket.getInetAddress(), + serverSocket.getLocalPort()); + clientSocket.close(); + } catch (Exception exception) { + // ignored... + exception.printStackTrace(); + } + } + waitUntilExhausted( + () -> expectedClosedCount == cleaner.getCloseSocketCount(), 5000); Review comment: Thanks for advice! -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: common-issues-unsubscr...@hadoop.apache.org For additional commands, e-mail: common-issues-h...@hadoop.apache.org