KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > springframework > scheduling > backportconcurrent > CustomizableThreadFactory


1 /*
2  * Copyright 2002-2007 the original author or authors.
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
17 package org.springframework.scheduling.backportconcurrent;
18
19 import edu.emory.mathcs.backport.java.util.concurrent.ThreadFactory;
20
21 import org.springframework.util.CustomizableThreadCreator;
22
23 /**
24  * Implementation of the JSR-166 backport
25  * {@link edu.emory.mathcs.backport.java.util.concurrent.ThreadFactory} interface,
26  * allowing for customizing the created threads (name, priority, etc).
27  *
28  * <p>See the base class {@link org.springframework.util.CustomizableThreadCreator}
29  * for details on the available configuration options.
30  *
31  * @author Juergen Hoeller
32  * @since 2.0.3
33  * @see #setThreadNamePrefix
34  * @see #setThreadPriority
35  */

36 public class CustomizableThreadFactory extends CustomizableThreadCreator implements ThreadFactory {
37
38     /**
39      * Create a new CustomizableThreadFactory with default thread name prefix.
40      */

41     public CustomizableThreadFactory() {
42         super();
43     }
44
45     /**
46      * Create a new CustomizableThreadFactory with the given thread name prefix.
47      * @param threadNamePrefix the prefix to use for the names of newly created threads
48      */

49     public CustomizableThreadFactory(String JavaDoc threadNamePrefix) {
50         super(threadNamePrefix);
51     }
52
53
54     public Thread JavaDoc newThread(Runnable JavaDoc runnable) {
55         return createThread(runnable);
56     }
57
58 }
59
Popular Tags