1
2
3
4
5
6
7
8
9
10
11 package org.mule.module.launcher;
12
13 import java.util.concurrent.ThreadFactory;
14 import java.util.concurrent.atomic.AtomicInteger;
15
16 public class AppDeployerMonitorThreadFactory implements ThreadFactory
17 {
18
19 static final AtomicInteger poolNumber = new AtomicInteger(1);
20 final ThreadGroup group;
21 final AtomicInteger threadNumber = new AtomicInteger(1);
22 final String namePrefix;
23
24 public AppDeployerMonitorThreadFactory()
25 {
26 SecurityManager s = System.getSecurityManager();
27 group = (s != null) ? s.getThreadGroup() :
28 Thread.currentThread().getThreadGroup();
29 namePrefix = String.format("Mule.app.deployer.monitor.%d.thread.", poolNumber.getAndIncrement());
30 }
31
32 public Thread newThread(Runnable r)
33 {
34 Thread t = new Thread(group, r,
35 namePrefix + threadNumber.getAndIncrement(),
36 0);
37
38 t.setDaemon(false);
39 t.setPriority(Thread.MIN_PRIORITY);
40 return t;
41 }
42
43
44 }