You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
54 lines
1.5 KiB
54 lines
1.5 KiB
5 years ago
|
package com.fr.plugin.db.redis.core.pool;
|
||
|
|
||
|
import com.fr.config.ConfigContext;
|
||
|
import com.fr.config.DefaultConfiguration;
|
||
|
import com.fr.config.holder.Conf;
|
||
|
import com.fr.config.holder.factory.Holders;
|
||
|
|
||
|
/**
|
||
|
* @author richie
|
||
|
* @version 10.0
|
||
|
* Created by richie on 2019-03-21
|
||
|
*/
|
||
|
public class RedisConnectionPoolConfig extends DefaultConfiguration {
|
||
|
|
||
|
private static volatile RedisConnectionPoolConfig instance = null;
|
||
|
|
||
|
public static RedisConnectionPoolConfig getInstance() {
|
||
|
if (instance == null) {
|
||
|
instance = ConfigContext.getConfigInstance(RedisConnectionPoolConfig.class);
|
||
|
}
|
||
|
return instance;
|
||
|
}
|
||
|
|
||
|
private static final int MAX_TOTAL = 10;
|
||
|
private static final int MAX_WAIT = -1;
|
||
|
|
||
|
private Conf<Integer> maxTotal = Holders.simple(MAX_TOTAL);
|
||
|
private Conf<Integer> maxWait = Holders.simple(MAX_WAIT);
|
||
|
|
||
|
public int getMaxTotal() {
|
||
|
return maxTotal.get();
|
||
|
}
|
||
|
|
||
|
public void setMaxTotal(Integer maxTotal) {
|
||
|
this.maxTotal.set(maxTotal);
|
||
|
}
|
||
|
|
||
|
public int getMaxWait() {
|
||
|
return maxWait.get();
|
||
|
}
|
||
|
|
||
|
public void setMaxWait(int maxWait) {
|
||
|
this.maxWait.set(maxWait);
|
||
|
}
|
||
|
|
||
|
@Override
|
||
|
public Object clone() throws CloneNotSupportedException {
|
||
|
RedisConnectionPoolConfig cloned = (RedisConnectionPoolConfig) super.clone();
|
||
|
cloned.maxTotal = (Conf<Integer>) maxTotal.clone();
|
||
|
cloned.maxWait = (Conf<Integer>) maxWait.clone();
|
||
|
return cloned;
|
||
|
}
|
||
|
}
|