1 16 package org.apache.cocoon.components.thread; 17 18 24 public class DefaultThreadFactory 25 implements ThreadFactory, EDU.oswego.cs.dl.util.concurrent.ThreadFactory 26 { 27 29 30 private boolean m_isDaemon = false; 31 32 33 private int m_priority = Thread.NORM_PRIORITY; 34 35 37 43 public void setDaemon( boolean isDaemon ) 44 { 45 m_isDaemon = isDaemon; 46 } 47 48 53 public boolean isDaemon( ) 54 { 55 return m_isDaemon; 56 } 57 58 64 public void setPriority( final int priority ) 65 { 66 if( ( Thread.MAX_PRIORITY == priority ) || 67 ( Thread.MIN_PRIORITY == priority ) || 68 ( Thread.NORM_PRIORITY == priority ) ) 69 { 70 m_priority = priority; 71 } 72 } 73 74 80 public int getPriority( ) 81 { 82 return m_priority; 83 } 84 85 92 public Thread newThread( final Runnable command ) 93 { 94 final Thread thread = new Thread ( command ); 95 thread.setPriority( m_priority ); 96 thread.setDaemon( m_isDaemon ); 97 98 return thread; 99 } 100 } 101 | Popular Tags |