cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cschnei...@apache.org
Subject svn commit: r1229089 - in /cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/osgi: CXFActivator.java ManagedWorkQueueList.java OSGIBusListener.java
Date Mon, 09 Jan 2012 10:37:28 GMT
Author: cschneider
Date: Mon Jan  9 10:37:28 2012
New Revision: 1229089

URL: http://svn.apache.org/viewvc?rev=1229089&view=rev
Log:
CXF-4014 Refactor some methods to ManagedWorkQueueList

Modified:
    cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/osgi/CXFActivator.java
    cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/osgi/ManagedWorkQueueList.java
    cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/osgi/OSGIBusListener.java

Modified: cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/osgi/CXFActivator.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/osgi/CXFActivator.java?rev=1229089&r1=1229088&r2=1229089&view=diff
==============================================================================
--- cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/osgi/CXFActivator.java (original)
+++ cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/osgi/CXFActivator.java Mon Jan  9 10:37:28
2012
@@ -25,7 +25,6 @@ import java.util.Properties;
 
 import org.apache.cxf.bus.extension.Extension;
 import org.apache.cxf.bus.extension.ExtensionRegistry;
-import org.apache.cxf.workqueue.AutomaticWorkQueueImpl;
 import org.osgi.framework.BundleActivator;
 import org.osgi.framework.BundleContext;
 import org.osgi.framework.Constants;
@@ -95,11 +94,7 @@ public class CXFActivator implements Bun
     public void stop(BundleContext context) throws Exception {
         context.removeBundleListener(cxfBundleListener);
         cxfBundleListener.shutdown();
-        for (AutomaticWorkQueueImpl wq : workQueues.queues.values()) {
-            wq.setShared(false);
-            wq.shutdown(true);
-        }
-        workQueues.queues.clear();
+        workQueues.shutDown();
         workQueueServiceRegistration.unregister();
         configAdminTracker.close();
         ExtensionRegistry.removeExtensions(extensions);

Modified: cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/osgi/ManagedWorkQueueList.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/osgi/ManagedWorkQueueList.java?rev=1229089&r1=1229088&r2=1229089&view=diff
==============================================================================
--- cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/osgi/ManagedWorkQueueList.java (original)
+++ cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/osgi/ManagedWorkQueueList.java Mon
Jan  9 10:37:28 2012
@@ -30,6 +30,7 @@ import org.apache.cxf.common.logging.Log
 import org.apache.cxf.helpers.CastUtils;
 import org.apache.cxf.service.factory.AbstractServiceFactoryBean;
 import org.apache.cxf.workqueue.AutomaticWorkQueueImpl;
+import org.apache.cxf.workqueue.WorkQueueManager;
 import org.osgi.service.cm.Configuration;
 import org.osgi.service.cm.ConfigurationAdmin;
 import org.osgi.service.cm.ConfigurationException;
@@ -43,7 +44,8 @@ public class ManagedWorkQueueList implem
     public static final String FACTORY_PID = "org.apache.cxf.workqueues";    
     private static final Logger LOG = LogUtils.getL7dLogger(AbstractServiceFactoryBean.class);
     
-    Map<String, AutomaticWorkQueueImpl> queues = new ConcurrentHashMap<String, AutomaticWorkQueueImpl>();
+    private Map<String, AutomaticWorkQueueImpl> queues = 
+        new ConcurrentHashMap<String, AutomaticWorkQueueImpl>();
     private ServiceTracker configAdminTracker;
     
     public String getName() {
@@ -72,6 +74,9 @@ public class ManagedWorkQueueList implem
         queues.remove(pid);
     }
 
+    /*
+     * On property changes of queue settings we update the config admin service pid of the
queue
+     */
     public void propertyChange(PropertyChangeEvent evt) {
         try {
             AutomaticWorkQueueImpl queue = (AutomaticWorkQueueImpl)evt.getSource();
@@ -103,8 +108,26 @@ public class ManagedWorkQueueList implem
         }
         return selectedConfig;
     }
+    
+    public void addAllToWorkQueueManager(WorkQueueManager manager) {
+        if (manager != null) {
+            for (AutomaticWorkQueueImpl wq : queues.values()) {
+                if (manager.getNamedWorkQueue(wq.getName()) == null) {
+                    manager.addNamedWorkQueue(wq.getName(), wq);
+                }
+            }
+        }
+    }
 
     public void setConfigAdminTracker(ServiceTracker configAdminTracker) {
         this.configAdminTracker = configAdminTracker;
     }
+
+    public void shutDown() {
+        for (AutomaticWorkQueueImpl wq : queues.values()) {
+            wq.setShared(false);
+            wq.shutdown(true);
+        }
+        queues.clear();
+    }
 }
\ No newline at end of file

Modified: cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/osgi/OSGIBusListener.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/osgi/OSGIBusListener.java?rev=1229089&r1=1229088&r2=1229089&view=diff
==============================================================================
--- cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/osgi/OSGIBusListener.java (original)
+++ cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/osgi/OSGIBusListener.java Mon Jan 
9 10:37:28 2012
@@ -31,7 +31,6 @@ import org.apache.cxf.endpoint.ClientLif
 import org.apache.cxf.endpoint.ClientLifeCycleManager;
 import org.apache.cxf.endpoint.ServerLifeCycleListener;
 import org.apache.cxf.endpoint.ServerLifeCycleManager;
-import org.apache.cxf.workqueue.AutomaticWorkQueueImpl;
 import org.apache.cxf.workqueue.WorkQueueManager;
 import org.osgi.framework.Bundle;
 import org.osgi.framework.BundleContext;
@@ -81,7 +80,9 @@ public class OSGIBusListener implements 
     public void initComplete() {
         WorkQueueManager manager = bus.getExtension(WorkQueueManager.class);
         ManagedWorkQueueList wqList = bus.getExtension(ManagedWorkQueueList.class);
-        addManagedWorkqueuesToManager(manager, wqList);
+        if (wqList != null) {
+            wqList.addAllToWorkQueueManager(manager);
+        }
         registerBusAsService();
     }
     
@@ -173,14 +174,4 @@ public class OSGIBusListener implements 
         }
     }
 
-    private void addManagedWorkqueuesToManager(WorkQueueManager manager, ManagedWorkQueueList
wqList) {
-        if (wqList != null && manager != null) {
-            for (AutomaticWorkQueueImpl wq : wqList.queues.values()) {
-                if (manager.getNamedWorkQueue(wq.getName()) == null) {
-                    manager.addNamedWorkQueue(wq.getName(), wq);
-                }
-            }
-        }
-    }
-
 }
\ No newline at end of file



Mime
View raw message