From 5d7a76e822571c57908aefd87b1d38e63be0ca70 Mon Sep 17 00:00:00 2001 From: Iwein Fuld Date: Fri, 9 Apr 2010 09:54:24 +0000 Subject: [PATCH] INT-1072: improved concurrent equals test --- .../integration/history/MessageHistoryTests.java | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/org.springframework.integration/src/test/java/org/springframework/integration/history/MessageHistoryTests.java b/org.springframework.integration/src/test/java/org/springframework/integration/history/MessageHistoryTests.java index fd46e6b296..9cde0ed6c1 100644 --- a/org.springframework.integration/src/test/java/org/springframework/integration/history/MessageHistoryTests.java +++ b/org.springframework.integration/src/test/java/org/springframework/integration/history/MessageHistoryTests.java @@ -33,7 +33,8 @@ public class MessageHistoryTests { @Test public void testConcurrentModificationsOnObjectMethods() throws Exception{ final MessageHistory history = new MessageHistory(); - + final MessageHistory otherHistory = new MessageHistory(); + executor.execute(new Runnable() { public void run() { for (int i = 0; i < times; i++) { @@ -42,29 +43,30 @@ public class MessageHistoryTests { event.setAttribute("bar", "bar"); event.setComponentName("MessageHistoryTests"); history.addEvent(event); + otherHistory.addEvent(event); } } }); - + executor.execute(new Runnable() { public void run() { for (int i = 0; i < times; i++) { history.toString(); - } + } } }); executor.execute(new Runnable() { public void run() { for (int i = 0; i < times; i++) { history.hashCode(); - } + } } }); executor.execute(new Runnable() { public void run() { for (int i = 0; i < times; i++) { history.equals(new Object()); - } + } } }); executor.shutdown();