| %line | %branch | |||||||||
|---|---|---|---|---|---|---|---|---|---|---|
| org.apache.jcs.utils.threadpool.ThreadPool |
|
|
| 1 | package org.apache.jcs.utils.threadpool; |
|
| 2 | ||
| 3 | /* |
|
| 4 | * Licensed to the Apache Software Foundation (ASF) under one |
|
| 5 | * or more contributor license agreements. See the NOTICE file |
|
| 6 | * distributed with this work for additional information |
|
| 7 | * regarding copyright ownership. The ASF licenses this file |
|
| 8 | * to you under the Apache License, Version 2.0 (the |
|
| 9 | * "License"); you may not use this file except in compliance |
|
| 10 | * with the License. You may obtain a copy of the License at |
|
| 11 | * |
|
| 12 | * http://www.apache.org/licenses/LICENSE-2.0 |
|
| 13 | * |
|
| 14 | * Unless required by applicable law or agreed to in writing, |
|
| 15 | * software distributed under the License is distributed on an |
|
| 16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
|
| 17 | * KIND, either express or implied. See the License for the |
|
| 18 | * specific language governing permissions and limitations |
|
| 19 | * under the License. |
|
| 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 | 100 | private PooledExecutor pool = null; |
| 34 | ||
| 35 | 100 | private Channel queue = null; |
| 36 | ||
| 37 | /** |
|
| 38 | * Create the wrapper. |
|
| 39 | * <p> |
|
| 40 | * @param pool |
|
| 41 | * @param queue |
|
| 42 | */ |
|
| 43 | 9 | public ThreadPool( PooledExecutor pool, Channel queue ) |
| 44 | 91 | { |
| 45 | 100 | this.pool = pool; |
| 46 | 100 | this.queue = queue; |
| 47 | 100 | } |
| 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 | 780 | return pool; |
| 57 | } |
|
| 58 | ||
| 59 | /** |
|
| 60 | * @return Returns the queue. |
|
| 61 | */ |
|
| 62 | public Channel getQueue() |
|
| 63 | { |
|
| 64 | 464 | 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 | 6588 | pool.execute( run ); |
| 77 | 6588 | } |
| 78 | } |
| This report is generated by jcoverage, Maven and Maven JCoverage Plugin. |