001/* 002 * HA-JDBC: High-Availability JDBC 003 * Copyright (C) 2012 Paul Ferraro 004 * 005 * This program is free software: you can redistribute it and/or modify 006 * it under the terms of the GNU Lesser General Public License as published by 007 * the Free Software Foundation, either version 3 of the License, or 008 * (at your option) any later version. 009 * 010 * This program is distributed in the hope that it will be useful, 011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 013 * GNU Lesser General Public License for more details. 014 * 015 * You should have received a copy of the GNU Lesser General Public License 016 * along with this program. If not, see <http://www.gnu.org/licenses/>. 017 */ 018package net.sf.hajdbc.pool.generic; 019 020import org.apache.commons.pool.impl.GenericObjectPool; 021 022 023/** 024 * Expose getters/setters to {@link org.apache.commons.pool.impl.GenericObjectPool.Config} properties. 025 * @author Paul Ferraro 026 */ 027public class GenericObjectPoolConfiguration 028{ 029 private final GenericObjectPool.Config config = new GenericObjectPool.Config(); 030 031 public GenericObjectPool.Config toConfig() 032 { 033 return this.config; 034 } 035 public int getMaxIdle() 036 { 037 return this.config.maxIdle; 038 } 039 public void setMaxIdle(int maxIdle) 040 { 041 this.config.maxIdle = maxIdle; 042 } 043 public int getMinIdle() 044 { 045 return this.config.minIdle; 046 } 047 public void setMinIdle(int minIdle) 048 { 049 this.config.minIdle = minIdle; 050 } 051 public int getMaxActive() 052 { 053 return this.config.maxActive; 054 } 055 public void setMaxActive(int maxActive) 056 { 057 this.config.maxActive = maxActive; 058 } 059 public long getMaxWait() 060 { 061 return this.config.maxWait; 062 } 063 public void setMaxWait(long maxWait) 064 { 065 this.config.maxWait = maxWait; 066 } 067 public byte getWhenExhaustedAction() 068 { 069 return this.config.whenExhaustedAction; 070 } 071 public void setWhenExhaustedAction(byte whenExhaustedAction) 072 { 073 this.config.whenExhaustedAction = whenExhaustedAction; 074 } 075 public boolean isTestOnBorrow() 076 { 077 return this.config.testOnBorrow; 078 } 079 public void setTestOnBorrow(boolean testOnBorrow) 080 { 081 this.config.testOnBorrow = testOnBorrow; 082 } 083 public boolean isTestOnReturn() 084 { 085 return this.config.testOnReturn; 086 } 087 public void setTestOnReturn(boolean testOnReturn) 088 { 089 this.config.testOnReturn = testOnReturn; 090 } 091 public boolean isTestWhileIdle() 092 { 093 return this.config.testWhileIdle; 094 } 095 public void setTestWhileIdle(boolean testWhileIdle) 096 { 097 this.config.testWhileIdle = testWhileIdle; 098 } 099 public long getTimeBetweenEvictionRunsMillis() 100 { 101 return this.config.timeBetweenEvictionRunsMillis; 102 } 103 public void setTimeBetweenEvictionRunsMillis(long timeBetweenEvictionRunsMillis) 104 { 105 this.config.timeBetweenEvictionRunsMillis = timeBetweenEvictionRunsMillis; 106 } 107 public int getNumTestsPerEvictionRun() 108 { 109 return this.config.numTestsPerEvictionRun; 110 } 111 public void setNumTestsPerEvictionRun(int numTestsPerEvictionRun) 112 { 113 this.config.numTestsPerEvictionRun = numTestsPerEvictionRun; 114 } 115 public long getMinEvictableIdleTimeMillis() 116 { 117 return this.config.minEvictableIdleTimeMillis; 118 } 119 public void setMinEvictableIdleTimeMillis(long minEvictableIdleTimeMillis) 120 { 121 this.config.minEvictableIdleTimeMillis = minEvictableIdleTimeMillis; 122 } 123 public long getSoftMinEvictableIdleTimeMillis() 124 { 125 return this.config.softMinEvictableIdleTimeMillis; 126 } 127 public void setSoftMinEvictableIdleTimeMillis(long softMinEvictableIdleTimeMillis) 128 { 129 this.config.softMinEvictableIdleTimeMillis = softMinEvictableIdleTimeMillis; 130 } 131 public boolean isLifo() 132 { 133 return this.config.lifo; 134 } 135 public void setLifo(boolean lifo) 136 { 137 this.config.lifo = lifo; 138 } 139}