cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r896994 - /cxf/trunk/rt/core/src/main/java/org/apache/cxf/workqueue/AutomaticWorkQueueImpl.java
Date Thu, 07 Jan 2010 20:13:46 GMT
Author: dkulp
Date: Thu Jan  7 20:13:45 2010
New Revision: 896994

URL: http://svn.apache.org/viewvc?rev=896994&view=rev
Log:
There is a potential problem if the workqueue drops to 0 threads, the
THreadGroup gets destroyed and no more work can be added.   Make sure
the threads are daemons, but the group is not to prevent it.

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

Modified: cxf/trunk/rt/core/src/main/java/org/apache/cxf/workqueue/AutomaticWorkQueueImpl.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/core/src/main/java/org/apache/cxf/workqueue/AutomaticWorkQueueImpl.java?rev=896994&r1=896993&r2=896994&view=diff
==============================================================================
--- cxf/trunk/rt/core/src/main/java/org/apache/cxf/workqueue/AutomaticWorkQueueImpl.java (original)
+++ cxf/trunk/rt/core/src/main/java/org/apache/cxf/workqueue/AutomaticWorkQueueImpl.java Thu
Jan  7 20:13:45 2010
@@ -144,7 +144,6 @@
         } catch (SecurityException e) { 
             group = new ThreadGroup(name + "-workqueue");
         }
-        group.setDaemon(true);
         return new AWQThreadFactory(group, name);
     }
     static class AWQThreadFactory implements ThreadFactory {
@@ -159,14 +158,15 @@
             loader = AutomaticWorkQueueImpl.class.getClassLoader();
         }
         public Thread newThread(Runnable r) {
+            if (group.isDestroyed()) {
+                group = new ThreadGroup(group.getParent(), name + "-workqueue");
+            }
             Thread t = new Thread(group, 
                                   r, 
                                   name + "-workqueue-" + threadNumber.getAndIncrement(),
                                   0);
             t.setContextClassLoader(loader);
-            if (!t.isDaemon()) {
-                t.setDaemon(true);
-            }
+            t.setDaemon(true);
             if (t.getPriority() != Thread.NORM_PRIORITY) {
                 t.setPriority(Thread.NORM_PRIORITY);
             }



Mime
View raw message