1 17 package org.apache.avalon.excalibur.thread.impl; 18 19 import org.apache.avalon.excalibur.pool.Poolable; 20 21 import org.apache.avalon.framework.logger.LogEnabled; 22 import org.apache.avalon.framework.logger.Logger; 23 24 import org.apache.excalibur.thread.impl.AbstractThreadPool; 25 import org.apache.excalibur.thread.impl.WorkerThread; 26 27 32 class SimpleWorkerThread 33 extends WorkerThread 34 implements Poolable, LogEnabled 35 { 36 39 private Logger m_logger; 40 41 44 private Logger m_detailLogger; 45 46 49 protected SimpleWorkerThread( final AbstractThreadPool pool, 50 final ThreadGroup group, 51 final String name ) 52 { 53 super( pool, group, name ); 54 } 55 56 public void enableLogging( final Logger logger ) 57 { 58 m_logger = logger; 59 m_detailLogger = logger.getChildLogger( "detail" ); 60 61 debug( "created." ); 64 } 65 66 72 protected void debug( final String message ) 73 { 74 if ( m_logger.isDebugEnabled() ) 75 { 76 m_logger.debug( "\"" + getName() + "\" " 82 + "(in " + Thread.currentThread().getName() + ") : " + message ); 83 } 84 } 85 86 93 protected void debug( final String message, final Throwable throwable ) 94 { 95 if ( m_logger.isDebugEnabled() ) 96 { 97 m_logger.debug( "\"" + getName() + "\" " 98 + "(in " + Thread.currentThread().getName() + ") : " + message, throwable ); 99 } 100 } 101 102 109 protected void detailDebug( final String message ) 110 { 111 if ( m_detailLogger.isDebugEnabled() ) 112 { 113 m_detailLogger.debug( "\"" + getName() + "\" " 114 + "(in " + Thread.currentThread().getName() + ") : " + message ); 115 } 116 } 117 118 126 protected void detailDebug( final String message, final Throwable throwable ) 127 { 128 if ( m_detailLogger.isDebugEnabled() ) 129 { 130 m_detailLogger.debug( "\"" + getName() + "\" " 131 + "(in " + Thread.currentThread().getName() + ") : " + message, throwable ); 132 } 133 } 134 } 135 136 | Popular Tags |