Comments (2)
It would be great if somehow the JedisPool exposed its Config prior to initializing, via a wrapper object that wraps around the GenericObjectPool.Config...with setters. For example, here's what we've had to do in order to work around current IOC-unfriendly limitations:
<bean id="jedisPool"
class="redis.clients.jedis.JedisPool"
destroy-method="destroy">
<constructor-arg>
<bean class="redis.clients.jedis.JedisPoolConfigWrapper"
p:maxActive="$test{redis.pool.maxActive}"
p:maxIdle="$test{redis.pool.maxIdle}"
p:maxWait="$test{redis.pool.maxWait}"
p:minIdle="$test{redis.pool.minIdle}"
p:testOnBorrow="$test{redis.pool.testOnBorrow}"
p:testOnReturn="$test{redis.pool.testOnReturn}"
p:testWhileIdle="$test{redis.pool.testWhileIdle}"/>
</constructor-arg>
<constructor-arg type="java.lang.String" value="$test{redis.host}"/>
<constructor-arg type="int" value="$test{redis.port}"/>
</bean>
...and here's the wrapper:
public class JedisPoolConfigWrapper extends GenericObjectPool.Config {
public boolean getLifo() {
return lifo;
}
public void setLifo(boolean lifo) {
this.lifo = lifo;
}
public int getMaxActive() {
return maxActive;
}
public void setMaxActive(int maxActive) {
this.maxActive = maxActive;
}
public int getMaxIdle() {
return maxIdle;
}
public void setMaxIdle(int maxIdle) {
this.maxIdle = maxIdle;
}
public long getMaxWait() {
return maxWait;
}
public void setMaxWait(long maxWait) {
this.maxWait = maxWait;
}
public long getMinEvictableIdleTimeMillis() {
return minEvictableIdleTimeMillis;
}
public void setMinEvictableIdleTimeMillis(long minEvictableIdleTimeMillis) {
this.minEvictableIdleTimeMillis = minEvictableIdleTimeMillis;
}
public int getMinIdle() {
return minIdle;
}
public void setMinIdle(int minIdle) {
this.minIdle = minIdle;
}
public int getNumTestsPerEvictionRun() {
return numTestsPerEvictionRun;
}
public void setNumTestsPerEvictionRun(int numTestsPerEvictionRun) {
this.numTestsPerEvictionRun = numTestsPerEvictionRun;
}
public long getSoftMinEvictableIdleTimeMillis() {
return softMinEvictableIdleTimeMillis;
}
public void setSoftMinEvictableIdleTimeMillis(long softMinEvictableIdleTimeMillis) {
this.softMinEvictableIdleTimeMillis = softMinEvictableIdleTimeMillis;
}
public boolean getTestOnBorrow() {
return testOnBorrow;
}
public void setTestOnBorrow(boolean testOnBorrow) {
this.testOnBorrow = testOnBorrow;
}
public boolean getTestOnReturn() {
return testOnReturn;
}
public void setTestOnReturn(boolean testOnReturn) {
this.testOnReturn = testOnReturn;
}
public boolean getTestWhileIdle() {
return testWhileIdle;
}
public void setTestWhileIdle(boolean testWhileIdle) {
this.testWhileIdle = testWhileIdle;
}
public long getTimeBetweenEvictionRunsMillis() {
return timeBetweenEvictionRunsMillis;
}
public void setTimeBetweenEvictionRunsMillis(long timeBetweenEvictionRunsMillis) {
this.timeBetweenEvictionRunsMillis = timeBetweenEvictionRunsMillis;
}
public byte getWhenExhaustedAction() {
return whenExhaustedAction;
}
public void setWhenExhaustedAction(byte whenExhaustedAction) {
this.whenExhaustedAction = whenExhaustedAction;
}
}
from jedis.
This is done in master branch already.
https://github.com/xetorthio/jedis/blob/master/src/main/java/redis/clients/jedis/JedisPoolConfig.java#L25
Thanks!
from jedis.
Related Issues (20)
- Create Java code snippets for hyperloglog HOT 1
- Create Java code snippets for Bloom HOT 1
- Create Java code snippets for cuckoo filters HOT 1
- Create Java code snippets for streams HOT 5
- Create Java code snippets for count min sketch HOT 2
- Create Java code snippets for top-k HOT 3
- Create Java code snippets for t-digest
- Idle connections cause JedisException on eviction process HOT 2
- server errorstat_ERR spike in version 4.4.0 HOT 2
- Incorrect result for a vector search query. HOT 4
- UnifiedJedis - can't use transaction and watch together
- How do I invoke commands provided by external modules? HOT 2
- Improve connection speed by running fewer commands HOT 1
- The close method of MultiNodePipelineBase will repeatedly call the sync method. HOT 4
- UnifiedJedis.ftAggregate always returning only 10 rows HOT 7
- CRUD Cache Jedis and Jackson HOT 4
- Broad usage of unchecked exceptions
- Missing JAR Signing Public Key ID HOT 2
- Did pipelined.sync() really close the pipeline and release the resource? HOT 2
- How to achieve high throughput using Jedis library
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jedis.