Skip to content
Browse files

Properly handle interruption

  • Loading branch information...
1 parent 49dfe9b commit 8c4c7a55ae0a00086d4659bbe46bb8f1d2dd0346 @matthieumorel matthieumorel committed Jan 9, 2013
Showing with 4 additions and 2 deletions.
  1. +4 −2 subprojects/s4-core/src/main/java/org/apache/s4/core/SenderImpl.java
View
6 subprojects/s4-core/src/main/java/org/apache/s4/core/SenderImpl.java
@@ -161,11 +161,13 @@ public void run() {
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);
-
}
}

0 comments on commit 8c4c7a5

Please sign in to comment.
Something went wrong with that request. Please try again.