Update of /var/cvs/src/org/mmbase/util
In directory james.mmbase.org:/tmp/cvs-serv16034

Modified Files:
        ThreadPools.java 
Log Message:
There are some dependencies on MMBaseContext, which made this unusable on 
rmmci. Fixed.


See also: http://cvs.mmbase.org/viewcvs/src/org/mmbase/util


Index: ThreadPools.java
===================================================================
RCS file: /var/cvs/src/org/mmbase/util/ThreadPools.java,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -b -r1.28 -r1.29
--- ThreadPools.java    21 Apr 2009 12:36:27 -0000      1.28
+++ ThreadPools.java    30 Apr 2009 18:48:43 -0000      1.29
@@ -18,11 +18,13 @@
  *
  * @since MMBase 1.8
  * @author Michiel Meeuwissen
- * @version $Id: ThreadPools.java,v 1.28 2009/04/21 12:36:27 michiel Exp $
+ * @version $Id: ThreadPools.java,v 1.29 2009/04/30 18:48:43 michiel Exp $
  */
 public abstract class ThreadPools {
     private static final Logger log = 
Logging.getLoggerInstance(ThreadPools.class);
 
+    public static final ThreadGroup threadGroup =  new ThreadGroup("MMBase 
Thread Pool");
+
     private static Map<Future, String> identifiers =
         Collections.synchronizedMap(new WeakHashMap<Future, String>());
 
@@ -70,7 +72,7 @@
 
     private static Thread newThread(Runnable r, final String id) {
         boolean isUp = 
org.mmbase.bridge.ContextProvider.getDefaultCloudContext().isUp();
-        Thread t = new 
Thread(org.mmbase.module.core.MMBaseContext.getThreadGroup(), r,
+        Thread t = new Thread(threadGroup, r,
                               isUp ? 
org.mmbase.module.core.MMBaseContext.getMachineName() + ":" + id : id) {
                 /**
                  * Overrides run of Thread to catch and log all exceptions. 
Otherwise they go through to app-server.
@@ -107,11 +109,18 @@
     static {
         jobsExecutor.execute(new Runnable() {
                 public void run() {
+                    String machineName;
+                    try {
                     
org.mmbase.bridge.ContextProvider.getDefaultCloudContext().assertUp();
+                        machineName = 
org.mmbase.module.core.MMBaseContext.getMachineName();
+                    } catch (NoClassDefFoundError cnfe) {
+                        // happens if no MMBaseContext, because this is used 
with the
+                        // rmmci-client jar.
+                        machineName = "localhost";
+                    }
                     for (Thread t : nameLess) {
-                        
t.setName(org.mmbase.module.core.MMBaseContext.getMachineName() + ":" + 
t.getName());
+                        t.setName(machineName + ":" + t.getName());
                     }
-                    nameLess = null;
                 }
             });
     }
_______________________________________________
Cvs mailing list
Cvs@lists.mmbase.org
http://lists.mmbase.org/mailman/listinfo/cvs

Reply via email to