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