You are viewing a plain text version of this content. The canonical link for it is here.
Posted to s4-commits@incubator.apache.org by mm...@apache.org on 2013/01/09 15:26:20 UTC

git commit: Properly handle interruption

Updated Branches:
  refs/heads/S4-95 49dfe9baf -> 8c4c7a55a


Properly handle interruption


Project: http://git-wip-us.apache.org/repos/asf/incubator-s4/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-s4/commit/8c4c7a55
Tree: http://git-wip-us.apache.org/repos/asf/incubator-s4/tree/8c4c7a55
Diff: http://git-wip-us.apache.org/repos/asf/incubator-s4/diff/8c4c7a55

Branch: refs/heads/S4-95
Commit: 8c4c7a55ae0a00086d4659bbe46bb8f1d2dd0346
Parents: 49dfe9b
Author: Matthieu Morel <mm...@apache.org>
Authored: Wed Jan 9 16:05:44 2013 +0100
Committer: Matthieu Morel <mm...@apache.org>
Committed: Wed Jan 9 16:05:44 2013 +0100

----------------------------------------------------------------------
 .../main/java/org/apache/s4/core/SenderImpl.java   |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-s4/blob/8c4c7a55/subprojects/s4-core/src/main/java/org/apache/s4/core/SenderImpl.java
----------------------------------------------------------------------
diff --git a/subprojects/s4-core/src/main/java/org/apache/s4/core/SenderImpl.java b/subprojects/s4-core/src/main/java/org/apache/s4/core/SenderImpl.java
index d2e731d..b103ad8 100644
--- a/subprojects/s4-core/src/main/java/org/apache/s4/core/SenderImpl.java
+++ b/subprojects/s4-core/src/main/java/org/apache/s4/core/SenderImpl.java
@@ -161,11 +161,13 @@ public class SenderImpl implements Sender {
                 if (localPartitionId != i) {
                     try {
                         emitter.send(i, serializedEvent);
+                        metrics.sentEvent(i);
                     } catch (InterruptedException e) {
                         logger.error("Interrupted blocking send operation for event {}. Event is lost.", event);
+                        // no reason to continue: we were interrupted, so we reset the interrupt status and leave
+                        Thread.currentThread().interrupt();
+                        break;
                     }
-                    metrics.sentEvent(i);
-
                 }
             }