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.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
37: CustomizableThreadCreator implements ThreadFactory {
38:
39: /**
40: * Create a new CustomizableThreadFactory with default thread name prefix.
41: */
42: public CustomizableThreadFactory() {
43: super ();
44: }
45:
46: /**
47: * Create a new CustomizableThreadFactory with the given thread name prefix.
48: * @param threadNamePrefix the prefix to use for the names of newly created threads
49: */
50: public CustomizableThreadFactory(String threadNamePrefix) {
51: super (threadNamePrefix);
52: }
53:
54: public Thread newThread(Runnable runnable) {
55: return createThread(runnable);
56: }
57:
58: }
|