You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@felix.apache.org by da...@apache.org on 2015/07/31 16:17:41 UTC

svn commit: r1693606 - /felix/trunk/framework/src/test/java/org/apache/felix/framework/ServiceRegistryTest.java

Author: davidb
Date: Fri Jul 31 14:17:41 2015
New Revision: 1693606

URL: http://svn.apache.org/r1693606
Log:
FELIX-4977 Service Registry Concurrency - add diagnostic counter to test.

Modified:
    felix/trunk/framework/src/test/java/org/apache/felix/framework/ServiceRegistryTest.java

Modified: felix/trunk/framework/src/test/java/org/apache/felix/framework/ServiceRegistryTest.java
URL: http://svn.apache.org/viewvc/felix/trunk/framework/src/test/java/org/apache/felix/framework/ServiceRegistryTest.java?rev=1693606&r1=1693605&r2=1693606&view=diff
==============================================================================
--- felix/trunk/framework/src/test/java/org/apache/felix/framework/ServiceRegistryTest.java (original)
+++ felix/trunk/framework/src/test/java/org/apache/felix/framework/ServiceRegistryTest.java Fri Jul 31 14:17:41 2015
@@ -30,6 +30,7 @@ import java.util.Observer;
 import java.util.concurrent.ConcurrentMap;
 import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.atomic.AtomicBoolean;
+import java.util.concurrent.atomic.AtomicInteger;
 
 import junit.framework.TestCase;
 
@@ -1052,15 +1053,18 @@ public class ServiceRegistryTest extends
 
                     final class ObserverImpl implements Observer
                     {
-
+//                        private volatile int counter = 0;
+                        private final AtomicInteger counter = new AtomicInteger();
                         public volatile boolean active = true;
 
                         @Override
                         public void update(Observable o, Object arg)
                         {
+//                            counter++; // Not completely atomic, but that doesn't matter here.
+                            counter.incrementAndGet();
                             if ( !active )
                             {
-                                throw new IllegalArgumentException();
+                                throw new IllegalArgumentException("Iteration:" + counter.get());
                             }
                         }