1 45 46 package org.exolab.jms.net.util; 47 48 49 55 public class ThreadFactory 56 implements EDU.oswego.cs.dl.util.concurrent.ThreadFactory { 57 58 61 private final ThreadGroup _group; 62 63 66 private final String _name; 67 68 71 private final boolean _daemon; 72 73 76 private volatile int _nameSeed = 0; 77 78 79 86 public ThreadFactory(ThreadGroup group, String name, boolean daemon) { 87 _group = group; 88 _name = name; 89 _daemon = daemon; 90 } 91 92 93 99 public Thread newThread(Runnable command) { 100 String name = null; 101 if (_name != null) { 102 int suffix = ++_nameSeed; 103 name = _name + suffix; 104 } 105 Thread thread = new Thread (_group, command, name); 106 thread.setDaemon(_daemon); 107 return thread; 108 } 109 } 110 | Popular Tags |