1 package org.apache.jcs.utils.threadpool;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 import EDU.oswego.cs.dl.util.concurrent.Channel;
23 import EDU.oswego.cs.dl.util.concurrent.PooledExecutor;
24
25 /***
26 * This is simply a wrapper around the Pooled Excutor that allows clients to
27 * access the queue.
28 * <p>
29 * @author aaronsm
30 */
31 public class ThreadPool
32 {
33 private PooledExecutor pool = null;
34
35 private Channel queue = null;
36
37 /***
38 * Create the wrapper.
39 * <p>
40 * @param pool
41 * @param queue
42 */
43 public ThreadPool( PooledExecutor pool, Channel queue )
44 {
45 this.pool = pool;
46 this.queue = queue;
47 }
48
49 /***
50 * This is intended to give the client access to the PooledExecutor itself.
51 * <p>
52 * @return Returns the pool.
53 */
54 public PooledExecutor getPool()
55 {
56 return pool;
57 }
58
59 /***
60 * @return Returns the queue.
61 */
62 public Channel getQueue()
63 {
64 return queue;
65 }
66
67 /***
68 * Delegates execution to the pooled executor.
69 * <p>
70 * @param run
71 * @throws InterruptedException
72 */
73 public void execute( Runnable run )
74 throws InterruptedException
75 {
76 pool.execute( run );
77 }
78 }