You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by bv...@apache.org on 2012/11/22 21:53:12 UTC
svn commit: r1412672 -
/camel/trunk/tests/camel-itest/src/test/java/org/apache/camel/itest/async/HttpAsyncCallbackTest.java
Author: bvahdat
Date: Thu Nov 22 20:53:11 2012
New Revision: 1412672
URL: http://svn.apache.org/viewvc?rev=1412672&view=rev
Log:
Fixed the broken test on the CI-Server (It was not thread-safe to call ArrayList.add() method concurrently).
Modified:
camel/trunk/tests/camel-itest/src/test/java/org/apache/camel/itest/async/HttpAsyncCallbackTest.java
Modified: camel/trunk/tests/camel-itest/src/test/java/org/apache/camel/itest/async/HttpAsyncCallbackTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/tests/camel-itest/src/test/java/org/apache/camel/itest/async/HttpAsyncCallbackTest.java?rev=1412672&r1=1412671&r2=1412672&view=diff
==============================================================================
--- camel/trunk/tests/camel-itest/src/test/java/org/apache/camel/itest/async/HttpAsyncCallbackTest.java (original)
+++ camel/trunk/tests/camel-itest/src/test/java/org/apache/camel/itest/async/HttpAsyncCallbackTest.java Thu Nov 22 20:53:11 2012
@@ -16,8 +16,8 @@
*/
package org.apache.camel.itest.async;
-import java.util.ArrayList;
import java.util.List;
+import java.util.Vector;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
@@ -67,7 +67,10 @@ public class HttpAsyncCallbackTest exten
*/
private static class MyCallback extends SynchronizationAdapter {
- private final List<String> data = new ArrayList<String>();
+ // below the String elements are added in the context of different threads so that we should make
+ // sure that this's done in a thread-safe manner, that's no two threads should call the data.add()
+ // method below concurrently, so why we use Vector here and not e.g. ArrayList
+ private final List<String> data = new Vector<String>();
@Override
public void onComplete(Exchange exchange) {