01: /*
02: * Copyright 2002-2007 the original author or authors.
03: *
04: * Licensed under the Apache License, Version 2.0 (the "License");
05: * you may not use this file except in compliance with the License.
06: * You may obtain a copy of the License at
07: *
08: * http://www.apache.org/licenses/LICENSE-2.0
09: *
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.concurrent;
18:
19: import java.util.concurrent.ThreadFactory;
20:
21: import org.springframework.util.CustomizableThreadCreator;
22:
23: /**
24: * Implementation of the JDK 1.5 {@link java.util.concurrent.ThreadFactory}
25: * interface, allowing for customizing the created threads (name, priority, etc).
26: *
27: * <p>See the base class {@link org.springframework.util.CustomizableThreadCreator}
28: * for details on the available configuration options.
29: *
30: * @author Juergen Hoeller
31: * @since 2.0.3
32: * @see #setThreadNamePrefix
33: * @see #setThreadPriority
34: */
35: public class CustomizableThreadFactory extends
36: 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 threadNamePrefix) {
50: super (threadNamePrefix);
51: }
52:
53: public Thread newThread(Runnable runnable) {
54: return createThread(runnable);
55: }
56:
57: }
|