added JedisPoolConfig getters/setters so object pool can be configured with Spring/IoC
This commit is contained in:
committed by
Jonathan Leibiusky
parent
a2a8bc0828
commit
1d5589f247
148
src/main/java/redis/clients/jedis/JedisPoolConfig.java
Normal file
148
src/main/java/redis/clients/jedis/JedisPoolConfig.java
Normal file
@@ -0,0 +1,148 @@
|
|||||||
|
package redis.clients.jedis;
|
||||||
|
|
||||||
|
import org.apache.commons.pool.impl.GenericObjectPool.Config;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Subclass of org.apache.commons.pool.impl.GenericObjectPool.Config that
|
||||||
|
* includes getters/setters so it can be more easily configured by Spring
|
||||||
|
* and other IoC frameworks.
|
||||||
|
*
|
||||||
|
* Spring example:
|
||||||
|
*
|
||||||
|
* <bean id="jedisConfig" class="redis.clients.jedis.JedisPoolConfig">
|
||||||
|
* <property name="testWhileIdle" value="true"/>
|
||||||
|
* </bean>
|
||||||
|
*
|
||||||
|
* <bean id="jedisPool" class="redis.clients.jedis.JedisPool" destroy-method="destroy">
|
||||||
|
* <constructor-arg ref="jedisConfig" />
|
||||||
|
* <constructor-arg value="localhost" />
|
||||||
|
* <constructor-arg type="int" value="6379" />
|
||||||
|
* </bean>
|
||||||
|
*
|
||||||
|
* For information on parameters refer to:
|
||||||
|
*
|
||||||
|
* http://commons.apache.org/pool/apidocs/org/apache/commons/pool/impl/GenericObjectPool.html
|
||||||
|
*/
|
||||||
|
public class JedisPoolConfig extends Config
|
||||||
|
{
|
||||||
|
public int getMaxIdle()
|
||||||
|
{
|
||||||
|
return maxIdle;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMaxIdle(int maxIdle)
|
||||||
|
{
|
||||||
|
this.maxIdle = maxIdle;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getMinIdle()
|
||||||
|
{
|
||||||
|
return minIdle;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMinIdle(int minIdle)
|
||||||
|
{
|
||||||
|
this.minIdle = minIdle;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getMaxActive()
|
||||||
|
{
|
||||||
|
return maxActive;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMaxActive(int maxActive)
|
||||||
|
{
|
||||||
|
this.maxActive = maxActive;
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getMaxWait()
|
||||||
|
{
|
||||||
|
return maxWait;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMaxWait(long maxWait)
|
||||||
|
{
|
||||||
|
this.maxWait = maxWait;
|
||||||
|
}
|
||||||
|
|
||||||
|
public byte getWhenExhaustedAction()
|
||||||
|
{
|
||||||
|
return whenExhaustedAction;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setWhenExhaustedAction(byte whenExhaustedAction)
|
||||||
|
{
|
||||||
|
this.whenExhaustedAction = whenExhaustedAction;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isTestOnBorrow()
|
||||||
|
{
|
||||||
|
return testOnBorrow;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTestOnBorrow(boolean testOnBorrow)
|
||||||
|
{
|
||||||
|
this.testOnBorrow = testOnBorrow;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isTestOnReturn()
|
||||||
|
{
|
||||||
|
return testOnReturn;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTestOnReturn(boolean testOnReturn)
|
||||||
|
{
|
||||||
|
this.testOnReturn = testOnReturn;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isTestWhileIdle()
|
||||||
|
{
|
||||||
|
return testWhileIdle;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTestWhileIdle(boolean testWhileIdle)
|
||||||
|
{
|
||||||
|
this.testWhileIdle = testWhileIdle;
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getTimeBetweenEvictionRunsMillis()
|
||||||
|
{
|
||||||
|
return timeBetweenEvictionRunsMillis;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTimeBetweenEvictionRunsMillis(long timeBetweenEvictionRunsMillis)
|
||||||
|
{
|
||||||
|
this.timeBetweenEvictionRunsMillis = timeBetweenEvictionRunsMillis;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getNumTestsPerEvictionRun()
|
||||||
|
{
|
||||||
|
return numTestsPerEvictionRun;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNumTestsPerEvictionRun(int numTestsPerEvictionRun)
|
||||||
|
{
|
||||||
|
this.numTestsPerEvictionRun = numTestsPerEvictionRun;
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getMinEvictableIdleTimeMillis()
|
||||||
|
{
|
||||||
|
return minEvictableIdleTimeMillis;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMinEvictableIdleTimeMillis(long minEvictableIdleTimeMillis)
|
||||||
|
{
|
||||||
|
this.minEvictableIdleTimeMillis = minEvictableIdleTimeMillis;
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getSoftMinEvictableIdleTimeMillis()
|
||||||
|
{
|
||||||
|
return softMinEvictableIdleTimeMillis;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSoftMinEvictableIdleTimeMillis(long softMinEvictableIdleTimeMillis)
|
||||||
|
{
|
||||||
|
this.softMinEvictableIdleTimeMillis = softMinEvictableIdleTimeMillis;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user