1 /* 2 * Copyright 1999-2004 The Apache Software Foundation. 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 package org.apache.cocoon.components.thread; 17 18 /** 19 * The ThreadFactory interface describes the responability of Factories 20 * creating Thread for {@link ThreadPool}s of the {@link RunnableManager} 21 * 22 * @author <a HREF="mailto:giacomo.at.apache.org">Giacomo Pati</a> 23 * @version CVS $Id: ThreadFactory.java 56765 2004-11-06 13:54:31Z giacomo $ 24 */ 25 public interface ThreadFactory 26 extends EDU.oswego.cs.dl.util.concurrent.ThreadFactory 27 { 28 //~ Methods ---------------------------------------------------------------- 29 30 /** 31 * Set the daemon mode of created <code>Thread</code>s should have 32 * 33 * @param isDaemon Whether new {@link Thread}s should run as daemons. 34 */ 35 void setDaemon( boolean isDaemon ); 36 37 /** 38 * Get the daemon mode created <code>Thread</code>s will have 39 * 40 * @return Whether new {@link Thread}s should run as daemons. 41 */ 42 boolean isDaemon( ); 43 44 /** 45 * Set the priority newly created <code>Thread</code>s should have 46 * 47 * @param priority One of {@link Thread#MIN_PRIORITY}, {@link 48 * Thread#NORM_PRIORITY}, {@link Thread#MAX_PRIORITY} 49 */ 50 void setPriority( int priority ); 51 52 /** 53 * Get the priority newly created <code>Thread</code>s will have 54 * 55 * @return One of {@link Thread#MIN_PRIORITY}, {@link 56 * Thread#NORM_PRIORITY}, {@link Thread#MAX_PRIORITY} 57 */ 58 int getPriority( ); 59 60 /** 61 * Create a new Thread for a {@link Runnable} command 62 * 63 * @param command The <code>Runnable</code> 64 * 65 * @return new <code>Thread</code> 66 */ 67 Thread newThread( Runnable command ); 68 } 69