View Javadoc

1   /*
2    * Copyright 2002-2005 the original author or authors.
3    *
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    *      http://www.apache.org/licenses/LICENSE-2.0
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  
17  package org.jencks.factory;
18  
19  import org.apache.geronimo.connector.outbound.connectionmanagerconfig.SinglePool;
20  import org.springframework.beans.factory.FactoryBean;
21  import org.springframework.beans.factory.InitializingBean;
22  
23  /***
24   * This FactoryBean creates the partitionned pool strategy for
25   * the Geronimo connection manager.
26   * <p/>
27   * This class is based on the common pool properties defined in
28   * the AbstractGeronimoPool class.
29   *
30   * @author Thierry Templier
31   * @see SinglePool
32   * @see AbstractGeronimoPool
33   * @see ConnectionManagerFactoryBean#setPoolingSupport(PoolingSupport)
34   */
35  public class SinglePoolFactoryBean extends AbstractGeronimoPool implements FactoryBean, InitializingBean {
36  
37      private SinglePool pool;
38  
39      public Object getObject() throws Exception {
40          return pool;
41      }
42  
43      public Class getObjectType() {
44          return SinglePool.class;
45      }
46  
47      public boolean isSingleton() {
48          return true;
49      }
50  
51      public void afterPropertiesSet() throws Exception {
52          this.pool = new SinglePool(maxSize, minSize, blockingTimeoutMilliseconds,
53                  idleTimeoutMinutes, matchOne, matchAll, selectOneAssumeMatch);
54      }
55  
56  }