Debian Codegraph @

src/main/java/net/sf/antcontrib/util/ThreadPoolThread.java

raw symbols SCIP
1 /*
2 * Copyright (c) 2001-2004 Ant-Contrib project. All rights reserved.
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 net.sf.antcontrib.util;
17
18
19
20
21 /****************************************************************************
22 * Place class description here.
23 *
24 * @author <a href='mailto:[email protected]'>Matthew Inger</a>
25 *
26 ****************************************************************************/
27
28
29 public class ThreadPoolThread
30 extends Thread
31 {
32
33 private ThreadPool pool;
34 private Runnable runnable;
35
36 public ThreadPoolThread(ThreadPool pool)
37 {
38 super();
39 this.pool = pool;
40 }
41
42 public void setRunnable(Runnable runnable)
43 {
44 this.runnable = runnable;
45 }
46
47
48 public void run()
49 {
50 try
51 {
52 if (runnable != null)
53 runnable.run();
54 }
55 finally
56 {
57 try
58 {
59 pool.returnThread(this);
60 }
61 catch (Exception e)
62 {
63 ; // gulp;
64 }
65 }
66 }
67 }