1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.jencks.factory;
18
19 import org.apache.geronimo.connector.outbound.connectionmanagerconfig.PartitionedPool;
20 import org.apache.geronimo.connector.outbound.connectionmanagerconfig.PoolingSupport;
21 import org.apache.geronimo.connector.outbound.connectionmanagerconfig.SinglePool;
22 import org.springframework.beans.factory.FactoryBean;
23 import org.springframework.beans.factory.InitializingBean;
24
25 /***
26 * This FactoryBean creates the partitionned pool strategy for
27 * the Geronimo connection manager.
28 * <p/>
29 * This class is based on the common pool properties defined in
30 * the AbstractGeronimoPool class and two other properties:
31 * partitionByConnectionRequestInfo to manage pooling with the
32 * request informations and partitionBySubject to manage pooling
33 * with the subjects.
34 *
35 * @author Thierry Templier
36 * @see PartitionedPool
37 * @see AbstractGeronimoPool
38 * @see ConnectionManagerFactoryBean#setPoolingSupport(PoolingSupport)
39 */
40 public class PartitionedPoolFactoryBean extends AbstractGeronimoPool implements FactoryBean, InitializingBean {
41
42 protected boolean partitionByConnectionRequestInfo;
43 protected boolean partitionBySubject;
44
45 private PartitionedPool pool;
46
47 public Object getObject() throws Exception {
48 return pool;
49 }
50
51 public Class getObjectType() {
52 return SinglePool.class;
53 }
54
55 public boolean isSingleton() {
56 return true;
57 }
58
59 /***
60 * Set the partitionByConnectionRequestInfo for the pool.
61 */
62 public void setPartitionByConnectionRequestInfo(boolean partitionByConnectionRequestInfo) {
63 this.partitionByConnectionRequestInfo = partitionByConnectionRequestInfo;
64 }
65
66 /***
67 * Set the partitionBySubject for the pool.
68 */
69 public void setPartitionBySubject(boolean partitionBySubject) {
70 this.partitionBySubject = partitionBySubject;
71 }
72
73 public void afterPropertiesSet() throws Exception {
74 this.pool = new PartitionedPool(maxSize, minSize, blockingTimeoutMilliseconds,
75 idleTimeoutMinutes, matchOne, matchAll, selectOneAssumeMatch,
76 partitionByConnectionRequestInfo, partitionBySubject);
77 }
78
79 }