From d4badebb64e1f6c230fe770424c8ed2676dec484 Mon Sep 17 00:00:00 2001 From: David Syer Date: Fri, 18 Jun 2010 14:23:51 +0000 Subject: [PATCH] INT-1069: FIx build (JDK bug in LinkedBlockingQueue) --- .../integration/store/SimpleMessageGroup.java | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/spring-integration-core/src/main/java/org/springframework/integration/store/SimpleMessageGroup.java b/spring-integration-core/src/main/java/org/springframework/integration/store/SimpleMessageGroup.java index 0700e67625..4f6adb66e6 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/store/SimpleMessageGroup.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/store/SimpleMessageGroup.java @@ -71,8 +71,17 @@ public class SimpleMessageGroup implements MessageGroup { public SimpleMessageGroup(MessageGroup template) { this.correlationKey = template.getCorrelationKey(); synchronized (lock) { - this.marked.addAll(template.getMarked()); - this.unmarked.addAll(template.getUnmarked()); + // Explicit iteration to work around bug in JDK (before 1.6.0_20 + for (Message message : template.getMarked()) { + if (message != null) { + this.marked.add(message); + } + } + for (Message message : template.getUnmarked()) { + if (message != null) { + this.unmarked.add(message); + } + } } this.timestamp = template.getTimestamp(); } @@ -155,7 +164,9 @@ public class SimpleMessageGroup implements MessageGroup { public void markAll() { synchronized (lock) { - unmarked.drainTo(marked); + marked.addAll(unmarked); + unmarked.clear(); + // unmarked.drainTo(marked); } }