felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pde...@apache.org
Subject svn commit: r1679807 - in /felix/sandbox/pderop/bndtools-FELIX-4866/org.apache.felix.framework.loadtest/src/org/apache/felix/framework/loadtest: dependency/Component.java dependency/ServiceDependency.java tracker/Benchmark.java
Date Sat, 16 May 2015 21:47:12 GMT
Author: pderop
Date: Sat May 16 21:47:12 2015
New Revision: 1679807

URL: http://svn.apache.org/r1679807
Log:
added some volatile (but this does not fix anything). code cleanup.

Modified:
    felix/sandbox/pderop/bndtools-FELIX-4866/org.apache.felix.framework.loadtest/src/org/apache/felix/framework/loadtest/dependency/Component.java
    felix/sandbox/pderop/bndtools-FELIX-4866/org.apache.felix.framework.loadtest/src/org/apache/felix/framework/loadtest/dependency/ServiceDependency.java
    felix/sandbox/pderop/bndtools-FELIX-4866/org.apache.felix.framework.loadtest/src/org/apache/felix/framework/loadtest/tracker/Benchmark.java

Modified: felix/sandbox/pderop/bndtools-FELIX-4866/org.apache.felix.framework.loadtest/src/org/apache/felix/framework/loadtest/dependency/Component.java
URL: http://svn.apache.org/viewvc/felix/sandbox/pderop/bndtools-FELIX-4866/org.apache.felix.framework.loadtest/src/org/apache/felix/framework/loadtest/dependency/Component.java?rev=1679807&r1=1679806&r2=1679807&view=diff
==============================================================================
--- felix/sandbox/pderop/bndtools-FELIX-4866/org.apache.felix.framework.loadtest/src/org/apache/felix/framework/loadtest/dependency/Component.java
(original)
+++ felix/sandbox/pderop/bndtools-FELIX-4866/org.apache.felix.framework.loadtest/src/org/apache/felix/framework/loadtest/dependency/Component.java
Sat May 16 21:47:12 2015
@@ -21,14 +21,14 @@ public class Component<T> {
     final Supplier<T> m_factory;
     final BundleContext m_ctx;
     final List<ServiceDependency<?, T>> m_dependencies = Collections.synchronizedList(new
ArrayList<>());
-    Consumer<T> m_start;
-    Consumer<T> m_stop;
+    volatile Consumer<T> m_start;
+    volatile Consumer<T> m_stop;
     final T m_instance;
     final AtomicInteger m_boundServices = new AtomicInteger(0);
-    AtomicBoolean m_started = new AtomicBoolean(false);
-    String m_provides;
-    Dictionary<String, ?> m_properties;
-    ServiceRegistration<?> m_registration;
+    final AtomicBoolean m_started = new AtomicBoolean(false);
+    volatile String m_provides;
+    volatile Dictionary<String, ?> m_properties;
+    volatile ServiceRegistration<?> m_registration;
 
     public static <U> Component<U> component(BundleContext ctx, Supplier<U>
factory) {
         return new Component<U>(ctx, factory);

Modified: felix/sandbox/pderop/bndtools-FELIX-4866/org.apache.felix.framework.loadtest/src/org/apache/felix/framework/loadtest/dependency/ServiceDependency.java
URL: http://svn.apache.org/viewvc/felix/sandbox/pderop/bndtools-FELIX-4866/org.apache.felix.framework.loadtest/src/org/apache/felix/framework/loadtest/dependency/ServiceDependency.java?rev=1679807&r1=1679806&r2=1679807&view=diff
==============================================================================
--- felix/sandbox/pderop/bndtools-FELIX-4866/org.apache.felix.framework.loadtest/src/org/apache/felix/framework/loadtest/dependency/ServiceDependency.java
(original)
+++ felix/sandbox/pderop/bndtools-FELIX-4866/org.apache.felix.framework.loadtest/src/org/apache/felix/framework/loadtest/dependency/ServiceDependency.java
Sat May 16 21:47:12 2015
@@ -16,7 +16,7 @@ class ServiceDependency<T, U> implements
 	final Component<U> m_component;
 	final BiConsumer<U, T> m_added;
 
-	ServiceTracker<T, T> m_tracker;
+	volatile ServiceTracker<T, T> m_tracker;
 	
 	ServiceDependency(BundleContext ctx, Class<T> service, String filter, Component<U>
component, BiConsumer<U, T> added) {
 		m_ctx = ctx;

Modified: felix/sandbox/pderop/bndtools-FELIX-4866/org.apache.felix.framework.loadtest/src/org/apache/felix/framework/loadtest/tracker/Benchmark.java
URL: http://svn.apache.org/viewvc/felix/sandbox/pderop/bndtools-FELIX-4866/org.apache.felix.framework.loadtest/src/org/apache/felix/framework/loadtest/tracker/Benchmark.java?rev=1679807&r1=1679806&r2=1679807&view=diff
==============================================================================
--- felix/sandbox/pderop/bndtools-FELIX-4866/org.apache.felix.framework.loadtest/src/org/apache/felix/framework/loadtest/tracker/Benchmark.java
(original)
+++ felix/sandbox/pderop/bndtools-FELIX-4866/org.apache.felix.framework.loadtest/src/org/apache/felix/framework/loadtest/tracker/Benchmark.java
Sat May 16 21:47:12 2015
@@ -63,10 +63,8 @@ public class Benchmark {
         return IntStream.range(0, ALBUMS).mapToObj(i -> {
             String id = Helper.generateId();
             artist.dependsOn(Album.class, "(id=" + id + ")", ArtistImpl::addAlbum);
-            return component(m_ctx, () -> new AlbumImpl(m_controller))
-                .onStart(AlbumImpl::start)
-                .onStop(AlbumImpl::stop)
-                .provides(Album.class, "id", id);
+            return component(m_ctx, () -> new AlbumImpl(m_controller)) 
+            	.onStart(AlbumImpl::start).onStop(AlbumImpl::stop).provides(Album.class, "id",
id);                
         });
     }
         
@@ -75,9 +73,7 @@ public class Benchmark {
             String id = Helper.generateId();
             album.dependsOn(Track.class, "(id=" + id + ")", AlbumImpl::addTrack);
             return component(m_ctx, () -> new TrackImpl(m_controller))
-                .onStart(TrackImpl::start)
-                .onStop(TrackImpl::stop)
-                .provides(Track.class, "id", id);
+                .onStart(TrackImpl::start).onStop(TrackImpl::stop).provides(Track.class,
"id", id);
         });
     }
 }



Mime
View raw message