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 {
25 pool = new GenericKeyedObjectPool();
26
27
28
29
30 pool.setTestOnBorrow(false);
31 pool.setTestOnReturn(true);
32 }
33
34 public Object borrowObject(Object key) throws Exception, NoSuchElementException, IllegalStateException
35 {
36 return pool.borrowObject(key);
37 }
38
39 public void returnObject(Object key, Object obj) throws Exception
40 {
41 pool.returnObject(key, obj);
42 }
43
44 public void invalidateObject(Object key, Object obj) throws Exception
45 {
46 pool.invalidateObject(key, obj);
47 }
48
49 public void addObject(Object key) throws Exception, IllegalStateException, UnsupportedOperationException
50 {
51 pool.addObject(key);
52 }
53
54 public int getNumIdle(Object key) throws UnsupportedOperationException
55 {
56 return pool.getNumIdle(key);
57 }
58
59 public int getNumActive(Object key) throws UnsupportedOperationException
60 {
61 return pool.getNumActive(key);
62 }
63
64 public int getNumIdle() throws UnsupportedOperationException
65 {
66 return pool.getNumIdle();
67 }
68
69 public int getNumActive() throws UnsupportedOperationException
70 {
71 return pool.getNumActive();
72 }
73
74 public void clear()
75 {
76 pool.clear();
77 }
78
79 public void clear(Object key) throws Exception, UnsupportedOperationException
80 {
81 pool.clear(key);
82 }
83
84 public void close() throws Exception
85 {
86 pool.close();
87 }
88
89 public void setFactory(KeyedPoolableObjectFactory factory) throws IllegalStateException, UnsupportedOperationException
90 {
91 pool.setFactory(factory);
92 }
93
94 public int getMaxActive()
95 {
96 return pool.getMaxActive();
97 }
98
99 public int getMaxTotal()
100 {
101 return pool.getMaxTotal();
102 }
103
104 public void setMaxWait(long maxWait)
105 {
106 pool.setMaxWait(maxWait);
107 }
108
109 public void setMaxActive(int maxActive)
110 {
111 pool.setMaxActive(maxActive);
112 }
113
114 public void setMaxIdle(int maxIdle)
115 {
116 pool.setMaxIdle(maxIdle);
117 }
118
119 public void setMaxTotal(int maxTotal)
120 {
121 pool.setMaxTotal(maxTotal);
122 }
123
124 public int getMaxIdle()
125 {
126 return pool.getMaxIdle();
127 }
128
129 public void setWhenExhaustedAction(byte whenExhaustedAction)
130 {
131 pool.setWhenExhaustedAction(whenExhaustedAction);
132 }
133
134 public byte getWhenExhaustedAction()
135 {
136 return pool.getWhenExhaustedAction();
137 }
138
139 public long getMaxWait()
140 {
141 return pool.getMaxWait();
142 }
143 }