You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-commits@axis.apache.org by ve...@apache.org on 2015/12/23 12:32:48 UTC
svn commit: r1721524 -
/axis/axis2/java/core/trunk/modules/jaxws-integration/test/org/apache/axis2/jaxws/dispatch/OMElementDispatchTest.java
Author: veithen
Date: Wed Dec 23 11:32:48 2015
New Revision: 1721524
URL: http://svn.apache.org/viewvc?rev=1721524&view=rev
Log:
Fix potential concurrency issue in unit test.
Modified:
axis/axis2/java/core/trunk/modules/jaxws-integration/test/org/apache/axis2/jaxws/dispatch/OMElementDispatchTest.java
Modified: axis/axis2/java/core/trunk/modules/jaxws-integration/test/org/apache/axis2/jaxws/dispatch/OMElementDispatchTest.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws-integration/test/org/apache/axis2/jaxws/dispatch/OMElementDispatchTest.java?rev=1721524&r1=1721523&r2=1721524&view=diff
==============================================================================
--- axis/axis2/java/core/trunk/modules/jaxws-integration/test/org/apache/axis2/jaxws/dispatch/OMElementDispatchTest.java (original)
+++ axis/axis2/java/core/trunk/modules/jaxws-integration/test/org/apache/axis2/jaxws/dispatch/OMElementDispatchTest.java Wed Dec 23 11:32:48 2015
@@ -25,6 +25,7 @@ import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.InputStream;
import java.io.StringReader;
+import java.util.concurrent.atomic.AtomicInteger;
import javax.xml.namespace.QName;
import javax.xml.stream.XMLInputFactory;
@@ -390,14 +391,14 @@ public class OMElementDispatchTest exten
* inserted to simulate getting a response from the Parser.
*/
public class ParsedEntityReaderTest implements ParsedEntityReader {
- int count =0;
+ private final AtomicInteger count = new AtomicInteger();
+
public boolean isParsedEntityStreamAvailable() {
return true;
}
public InputStream readParsedEntityStream(XMLStreamReader reader) {
- count++;
- if (count == 2) {
+ if (count.incrementAndGet() == 2) {
return new ByteArrayInputStream(testResponse.getBytes());
} else {
return null;