[GitHub] zookeeper pull request #334: ZOOKEEPER-2836 SocketTimeoutException

2017-08-14 Thread bitgaoshu
Github user bitgaoshu commented on a diff in the pull request:

https://github.com/apache/zookeeper/pull/334#discussion_r132887998
  
--- Diff: 
src/java/main/org/apache/zookeeper/server/quorum/QuorumCnxManager.java ---
@@ -647,11 +648,11 @@ public void run() {
 numRetries = 0;
 }
 } catch (IOException e) {
-if (shutdown) {
-break;
-}
 LOG.error("Exception while listening", e);
-numRetries++;
+if (!(e instanceof SocketTimeoutException)) {
+numRetries++;
+}
+}finally {
--- End diff --

it's my first time to commit code on github. i open a new  
[pr](https://github.com/apache/zookeeper/pull/336), which has fixed according 
to your opinion.  I am sorry for my inconvenience. 


---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] zookeeper pull request #334: ZOOKEEPER-2836 SocketTimeoutException

2017-08-13 Thread bitgaoshu
Github user bitgaoshu commented on a diff in the pull request:

https://github.com/apache/zookeeper/pull/334#discussion_r132868731
  
--- Diff: 
src/java/main/org/apache/zookeeper/server/quorum/QuorumCnxManager.java ---
@@ -647,11 +648,11 @@ public void run() {
 numRetries = 0;
 }
 } catch (IOException e) {
-if (shutdown) {
-break;
-}
 LOG.error("Exception while listening", e);
-numRetries++;
+if (!(e instanceof SocketTimeoutException)) {
+numRetries++;
+}
+}finally {
--- End diff --

1. i had removed **finally** code block in my newest code.
2. according to jira , the **SocketTimeoutException** was likely thrown 
every about 49days, maybe unsigned int -1. Or, we can follow 
[Karaf](https://issues.apache.org/jira/browse/KARAF-3325l) to fix this code. 
but i think it was thrown too often.


---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] zookeeper pull request #334: ZOOKEEPER-2836 SocketTimeoutException

2017-08-12 Thread maoling
Github user maoling commented on a diff in the pull request:

https://github.com/apache/zookeeper/pull/334#discussion_r132820615
  
--- Diff: 
src/java/main/org/apache/zookeeper/server/quorum/QuorumCnxManager.java ---
@@ -647,11 +648,11 @@ public void run() {
 numRetries = 0;
 }
 } catch (IOException e) {
-if (shutdown) {
-break;
-}
 LOG.error("Exception while listening", e);
-numRetries++;
+if (!(e instanceof SocketTimeoutException)) {
+numRetries++;
+}
+}finally {
--- End diff --

1. add a space between **}** and **finally**
2. why we need to move some codes about closing **ServerSocket** in 
**catch** code block to **finally** code block? this will 
   make codes in **Line677-Line685** redundant
3. If **numRetries** don't count **SocketTimeoutExceptions**.is this code 
facing an endless loop if SocketTimeoutExceptions always happen for a long 
time? this way of handling SocketTimeoutException is appropriate?


---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] zookeeper pull request #334: ZOOKEEPER-2836 SocketTimeoutException

2017-08-11 Thread bitgaoshu
Github user bitgaoshu closed the pull request at:

https://github.com/apache/zookeeper/pull/334


---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] zookeeper pull request #334: ZOOKEEPER-2836 SocketTimeoutException

2017-08-11 Thread bitgaoshu
GitHub user bitgaoshu opened a pull request:

https://github.com/apache/zookeeper/pull/334

ZOOKEEPER-2836 SocketTimeoutException



You can merge this pull request into a Git repository by running:

$ git pull https://github.com/bitgaoshu/zookeeper fix/ZOOKEEPER-2836

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/zookeeper/pull/334.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #334


commit 313406fdb0bd247c897409d8dbf800f6a6d62ce4
Author: fengwei 
Date:   2017-08-11T09:10:06Z

ZOOKEEPER-2836 SocketTimeoutException




---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---