1 | |
package org.apache.ojb.broker.core; |
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
|
16 | |
|
17 | |
|
18 | |
import org.apache.ojb.broker.util.configuration.Configurable; |
19 | |
import org.apache.ojb.broker.util.configuration.Configuration; |
20 | |
import org.apache.ojb.broker.util.configuration.ConfigurationException; |
21 | |
import org.apache.ojb.broker.util.configuration.impl.OjbConfigurator; |
22 | |
import org.apache.ojb.broker.util.logging.LoggerFactory; |
23 | |
import org.apache.ojb.broker.util.pooling.PoolConfiguration; |
24 | |
|
25 | |
import java.util.Properties; |
26 | |
|
27 | |
public class PBPoolInfo extends PoolConfiguration implements Configurable |
28 | |
{ |
29 | |
private static final long serialVersionUID = 3331426619896735439L; |
30 | |
|
31 | |
public PBPoolInfo() |
32 | |
{ |
33 | |
super(); |
34 | |
init(); |
35 | |
OjbConfigurator.getInstance().configure(this); |
36 | |
} |
37 | |
|
38 | |
public PBPoolInfo(Properties properties) |
39 | |
{ |
40 | |
super(); |
41 | |
init(); |
42 | |
OjbConfigurator.getInstance().configure(this); |
43 | |
this.putAll(properties); |
44 | |
} |
45 | |
|
46 | |
|
47 | |
|
48 | |
|
49 | |
public void configure(Configuration pConfig) throws ConfigurationException |
50 | |
{ |
51 | |
if (pConfig instanceof PBPoolConfiguration) |
52 | |
{ |
53 | |
PBPoolConfiguration conf = (PBPoolConfiguration) pConfig; |
54 | |
this.setMaxActive(conf.getMaxActive()); |
55 | |
this.setMaxIdle(conf.getMaxIdle()); |
56 | |
this.setMaxWait(conf.getMaxWaitMillis()); |
57 | |
this.setMinEvictableIdleTimeMillis(conf.getMinEvictableIdleTimeMillis()); |
58 | |
this.setTimeBetweenEvictionRunsMillis(conf.getTimeBetweenEvictionRunsMilli()); |
59 | |
this.setWhenExhaustedAction(conf.getWhenExhaustedAction()); |
60 | |
} |
61 | |
else |
62 | |
{ |
63 | |
LoggerFactory.getDefaultLogger().error(this.getClass().getName() + |
64 | |
" cannot read configuration properties, use default."); |
65 | |
} |
66 | |
} |
67 | |
|
68 | |
|
69 | |
|
70 | |
|
71 | |
|
72 | |
|
73 | |
|
74 | |
public void init() |
75 | |
{ |
76 | |
this.setTestOnBorrow(false); |
77 | |
this.setTestOnReturn(false); |
78 | |
this.setTestWhileIdle(false); |
79 | |
} |
80 | |
} |