1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
package org.mule.transport; |
8 | |
|
9 | |
import java.util.NoSuchElementException; |
10 | |
|
11 | |
import org.apache.commons.pool.KeyedPoolableObjectFactory; |
12 | |
import org.apache.commons.pool.impl.GenericKeyedObjectPool; |
13 | |
|
14 | |
|
15 | |
|
16 | |
|
17 | |
|
18 | |
public class DefaultConfigurableKeyedObjectPool implements ConfigurableKeyedObjectPool |
19 | |
{ |
20 | |
|
21 | |
private final GenericKeyedObjectPool pool; |
22 | |
|
23 | |
public DefaultConfigurableKeyedObjectPool() |
24 | 0 | { |
25 | 0 | pool = new GenericKeyedObjectPool(); |
26 | |
|
27 | |
|
28 | |
|
29 | |
|
30 | 0 | pool.setTestOnBorrow(false); |
31 | 0 | pool.setTestOnReturn(true); |
32 | 0 | } |
33 | |
|
34 | |
public Object borrowObject(Object key) throws Exception, NoSuchElementException, IllegalStateException |
35 | |
{ |
36 | 0 | return pool.borrowObject(key); |
37 | |
} |
38 | |
|
39 | |
public void returnObject(Object key, Object obj) throws Exception |
40 | |
{ |
41 | 0 | pool.returnObject(key, obj); |
42 | 0 | } |
43 | |
|
44 | |
public void invalidateObject(Object key, Object obj) throws Exception |
45 | |
{ |
46 | 0 | pool.invalidateObject(key, obj); |
47 | 0 | } |
48 | |
|
49 | |
public void addObject(Object key) throws Exception, IllegalStateException, UnsupportedOperationException |
50 | |
{ |
51 | 0 | pool.addObject(key); |
52 | 0 | } |
53 | |
|
54 | |
public int getNumIdle(Object key) throws UnsupportedOperationException |
55 | |
{ |
56 | 0 | return pool.getNumIdle(key); |
57 | |
} |
58 | |
|
59 | |
public int getNumActive(Object key) throws UnsupportedOperationException |
60 | |
{ |
61 | 0 | return pool.getNumActive(key); |
62 | |
} |
63 | |
|
64 | |
public int getNumIdle() throws UnsupportedOperationException |
65 | |
{ |
66 | 0 | return pool.getNumIdle(); |
67 | |
} |
68 | |
|
69 | |
public int getNumActive() throws UnsupportedOperationException |
70 | |
{ |
71 | 0 | return pool.getNumActive(); |
72 | |
} |
73 | |
|
74 | |
public void clear() |
75 | |
{ |
76 | 0 | pool.clear(); |
77 | 0 | } |
78 | |
|
79 | |
public void clear(Object key) throws Exception, UnsupportedOperationException |
80 | |
{ |
81 | 0 | pool.clear(key); |
82 | 0 | } |
83 | |
|
84 | |
public void close() throws Exception |
85 | |
{ |
86 | 0 | pool.close(); |
87 | 0 | } |
88 | |
|
89 | |
public void setFactory(KeyedPoolableObjectFactory factory) throws IllegalStateException, UnsupportedOperationException |
90 | |
{ |
91 | 0 | pool.setFactory(factory); |
92 | 0 | } |
93 | |
|
94 | |
public int getMaxActive() |
95 | |
{ |
96 | 0 | return pool.getMaxActive(); |
97 | |
} |
98 | |
|
99 | |
public int getMaxTotal() |
100 | |
{ |
101 | 0 | return pool.getMaxTotal(); |
102 | |
} |
103 | |
|
104 | |
public void setMaxWait(long maxWait) |
105 | |
{ |
106 | 0 | pool.setMaxWait(maxWait); |
107 | 0 | } |
108 | |
|
109 | |
public void setMaxActive(int maxActive) |
110 | |
{ |
111 | 0 | pool.setMaxActive(maxActive); |
112 | 0 | } |
113 | |
|
114 | |
public void setMaxIdle(int maxIdle) |
115 | |
{ |
116 | 0 | pool.setMaxIdle(maxIdle); |
117 | 0 | } |
118 | |
|
119 | |
public void setMaxTotal(int maxTotal) |
120 | |
{ |
121 | 0 | pool.setMaxTotal(maxTotal); |
122 | 0 | } |
123 | |
|
124 | |
public int getMaxIdle() |
125 | |
{ |
126 | 0 | return pool.getMaxIdle(); |
127 | |
} |
128 | |
|
129 | |
public void setWhenExhaustedAction(byte whenExhaustedAction) |
130 | |
{ |
131 | 0 | pool.setWhenExhaustedAction(whenExhaustedAction); |
132 | 0 | } |
133 | |
|
134 | |
public byte getWhenExhaustedAction() |
135 | |
{ |
136 | 0 | return pool.getWhenExhaustedAction(); |
137 | |
} |
138 | |
|
139 | |
public long getMaxWait() |
140 | |
{ |
141 | 0 | return pool.getMaxWait(); |
142 | |
} |
143 | |
} |