Github user eribeiro commented on a diff in the pull request:
https://github.com/apache/zookeeper/pull/257#discussion_r117441737
--- Diff: src/java/test/org/apache/zookeeper/test/CnxManagerTest.java ---
@@ -351,15 +351,55 @@ public void testSocketTimeout() throws Exception {
LOG.info("Election port: " + port);
Thread.sleep(1000);
- Socket sock = new Socket();
- sock.connect(peers.get(1L).electionAddr, 5000);
- long begin = Time.currentElapsedTime();
- // Read without sending data. Verify timeout.
- cnxManager.receiveConnection(sock);
- long end = Time.currentElapsedTime();
- if((end - begin) > ((peer.getSyncLimit() * peer.getTickTime()) +
500)) Assert.fail("Waited more than necessary");
- cnxManager.halt();
- Assert.assertFalse(cnxManager.listener.isAlive());
+ try (Socket sock = new Socket()) {
--- End diff --
It looks like the reason for changing those lines was to include a ARM
block, right?
I understand the motivation and have to refrain myself from doing the same
a couple of times, but this kind of refactoring would be goal of a separate
issue as **it is not related to the bug/feature of this issue** (aka _don't fix
if it's not broken_).
So, it revert it to the original one, please. :)
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---