cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r1207979 - /cxf/trunk/rt/core/src/main/java/org/apache/cxf/workqueue/WorkQueueManagerImpl.java
Date Tue, 29 Nov 2011 17:22:43 GMT
Author: dkulp
Date: Tue Nov 29 17:22:42 2011
New Revision: 1207979

URL: http://svn.apache.org/viewvc?rev=1207979&view=rev
Log:
[CXF-3915] Properly keep track of the number of shared users of hte
workqueue

Modified:
    cxf/trunk/rt/core/src/main/java/org/apache/cxf/workqueue/WorkQueueManagerImpl.java

Modified: cxf/trunk/rt/core/src/main/java/org/apache/cxf/workqueue/WorkQueueManagerImpl.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/core/src/main/java/org/apache/cxf/workqueue/WorkQueueManagerImpl.java?rev=1207979&r1=1207978&r2=1207979&view=diff
==============================================================================
--- cxf/trunk/rt/core/src/main/java/org/apache/cxf/workqueue/WorkQueueManagerImpl.java (original)
+++ cxf/trunk/rt/core/src/main/java/org/apache/cxf/workqueue/WorkQueueManagerImpl.java Tue
Nov 29 17:22:42 2011
@@ -108,13 +108,21 @@ public class WorkQueueManagerImpl implem
         for (AutomaticWorkQueue q : namedQueues.values()) {
             if (q instanceof AutomaticWorkQueueImpl) {
                 AutomaticWorkQueueImpl impl = (AutomaticWorkQueueImpl)q;
-                if (impl.isShared() && imanager != null 
-                    && imanager.getMBeanServer() != null) {
+                if (impl.isShared()) {
                     synchronized (impl) {
                         impl.removeSharedUser();
+                        
+                        if (impl.getShareCount() == 0 
+                            && imanager != null 
+                            && imanager.getMBeanServer() != null) {
+                            try {
+                                imanager.unregister(new WorkQueueImplMBeanWrapper(impl, this));
+                            } catch (JMException jmex) {
+                                LOG.log(Level.WARNING , jmex.getMessage(), jmex);
+                            }
+                        }
                     }
-                }
-                if (!impl.isShared()) {
+                } else {
                     q.shutdown(processRemainingTasks);
                 }
             } else {
@@ -161,15 +169,16 @@ public class WorkQueueManagerImpl implem
             AutomaticWorkQueueImpl impl = (AutomaticWorkQueueImpl)q;
             if (impl.isShared()) {
                 synchronized (impl) {
-                    if (impl.getShareCount() == 0 && imanager != null 
+                    if (impl.getShareCount() == 0 
+                        && imanager != null 
                         && imanager.getMBeanServer() != null) {
                         try {
                             imanager.register(new WorkQueueImplMBeanWrapper((AutomaticWorkQueueImpl)q,
this));
                         } catch (JMException jmex) {
                             LOG.log(Level.WARNING , jmex.getMessage(), jmex);
                         }
-                        impl.addSharedUser();
                     }
+                    impl.addSharedUser();
                 }
             } else if (imanager != null) {
                 try {



Mime
View raw message