incubator-s4-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mmo...@apache.org
Subject [14/15] git commit: Properly handle interruption
Date Fri, 18 Jan 2013 12:16:45 GMT
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/dev
Commit: 8c4c7a55ae0a00086d4659bbe46bb8f1d2dd0346
Parents: 49dfe9b
Author: Matthieu Morel <mmorel@apache.org>
Authored: Wed Jan 9 16:05:44 2013 +0100
Committer: Matthieu Morel <mmorel@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);
-
                 }
             }
 


Mime
View raw message