1 | // $Id: PoolOperator.java,v 1.2 2003-08-23 16:53:47 cvs Exp $ |
2 | |
3 | package diskCacheV111.poolManager ; |
4 | |
5 | import dmg.cells.nucleus.* ; |
6 | import java.util.* ; |
7 | import diskCacheV111.vehicles.* ; |
8 | |
9 | import org.slf4j.Logger; |
10 | import org.slf4j.LoggerFactory; |
11 | |
12 | public class PoolOperator |
13 | extends CostModuleV1 |
14 | { |
15 | private final static Logger _log = LoggerFactory.getLogger(PoolOperator.class); |
16 | |
17 | private HashMap _poolHash = new HashMap() ; |
18 | |
19 | public PoolOperator() |
20 | { |
21 | super(); |
22 | } |
23 | |
24 | public synchronized void messageArrived(PoolManagerPoolUpMessage msg) |
25 | { |
26 | super.messageArrived(msg); |
27 | _poolHash.put(msg.getPoolName(), msg.getTagMap()); |
28 | } |
29 | |
30 | public PoolCostCheckable getPoolCost( String poolName , long filesize ){ |
31 | |
32 | // System.out.println("PoolOperator : getPoolCost "+poolName ) ; |
33 | try{ |
34 | PoolCostCheckable cost = super.getPoolCost( poolName , filesize ) ; |
35 | if( cost == null )return null ; |
36 | Map map = (Map)_poolHash.get( poolName ) ; |
37 | if( map != null )cost.setTagMap(map) ; |
38 | return cost ; |
39 | }catch(MissingResourceException ee ){ |
40 | _log.error( "Missing resource exception from get cost : "+ee ) ; |
41 | return null ; |
42 | } |
43 | |
44 | } |
45 | } |