|
|
@ -49,41 +49,41 @@ public class Config {
|
|
|
|
private ClusterServersConfig clusterServersConfig;
|
|
|
|
private ClusterServersConfig clusterServersConfig;
|
|
|
|
|
|
|
|
|
|
|
|
private ReplicatedServersConfig replicatedServersConfig;
|
|
|
|
private ReplicatedServersConfig replicatedServersConfig;
|
|
|
|
|
|
|
|
|
|
|
|
private ConnectionManager connectionManager;
|
|
|
|
private ConnectionManager connectionManager;
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* Threads amount shared between all redis node clients
|
|
|
|
* Threads amount shared between all redis node clients
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
private int threads = 16;
|
|
|
|
private int threads = 16;
|
|
|
|
|
|
|
|
|
|
|
|
private int nettyThreads = 32;
|
|
|
|
private int nettyThreads = 32;
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* Redis key/value codec. JsonJacksonCodec used by default
|
|
|
|
* Redis key/value codec. JsonJacksonCodec used by default
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
private Codec codec;
|
|
|
|
private Codec codec;
|
|
|
|
|
|
|
|
|
|
|
|
private ExecutorService executor;
|
|
|
|
private ExecutorService executor;
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* Config option for enabling Redisson Reference feature.
|
|
|
|
* Config option for enabling Redisson Reference feature.
|
|
|
|
* Default value is TRUE
|
|
|
|
* Default value is TRUE
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
private boolean referenceEnabled = true;
|
|
|
|
private boolean referenceEnabled = true;
|
|
|
|
|
|
|
|
|
|
|
|
private TransportMode transportMode = TransportMode.NIO;
|
|
|
|
private TransportMode transportMode = TransportMode.NIO;
|
|
|
|
|
|
|
|
|
|
|
|
private EventLoopGroup eventLoopGroup;
|
|
|
|
private EventLoopGroup eventLoopGroup;
|
|
|
|
|
|
|
|
|
|
|
|
private long lockWatchdogTimeout = 30 * 1000;
|
|
|
|
private long lockWatchdogTimeout = 30 * 1000;
|
|
|
|
|
|
|
|
|
|
|
|
private boolean keepPubSubOrder = true;
|
|
|
|
private boolean keepPubSubOrder = true;
|
|
|
|
|
|
|
|
|
|
|
|
private boolean decodeInExecutor = false;
|
|
|
|
private boolean decodeInExecutor = false;
|
|
|
|
|
|
|
|
|
|
|
|
private boolean useScriptCache = false;
|
|
|
|
private boolean useScriptCache = false;
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* AddressResolverGroupFactory switch between default and round robin
|
|
|
|
* AddressResolverGroupFactory switch between default and round robin
|
|
|
|
*/
|
|
|
|
*/
|
|
|
@ -91,7 +91,7 @@ public class Config {
|
|
|
|
|
|
|
|
|
|
|
|
public Config() {
|
|
|
|
public Config() {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static {
|
|
|
|
static {
|
|
|
|
URIBuilder.patchUriObject();
|
|
|
|
URIBuilder.patchUriObject();
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -132,7 +132,7 @@ public class Config {
|
|
|
|
setReplicatedServersConfig(new ReplicatedServersConfig(oldConf.getReplicatedServersConfig()));
|
|
|
|
setReplicatedServersConfig(new ReplicatedServersConfig(oldConf.getReplicatedServersConfig()));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (oldConf.getConnectionManager() != null) {
|
|
|
|
if (oldConf.getConnectionManager() != null) {
|
|
|
|
useCustomServers(oldConf.getConnectionManager());
|
|
|
|
useCustomServers(oldConf.getConnectionManager());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -153,7 +153,7 @@ public class Config {
|
|
|
|
public Codec getCodec() {
|
|
|
|
public Codec getCodec() {
|
|
|
|
return codec;
|
|
|
|
return codec;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* Config option indicate whether Redisson Reference feature is enabled.
|
|
|
|
* Config option indicate whether Redisson Reference feature is enabled.
|
|
|
|
* <p>
|
|
|
|
* <p>
|
|
|
@ -175,7 +175,7 @@ public class Config {
|
|
|
|
public void setReferenceEnabled(boolean redissonReferenceEnabled) {
|
|
|
|
public void setReferenceEnabled(boolean redissonReferenceEnabled) {
|
|
|
|
this.referenceEnabled = redissonReferenceEnabled;
|
|
|
|
this.referenceEnabled = redissonReferenceEnabled;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* Init cluster servers configuration
|
|
|
|
* Init cluster servers configuration
|
|
|
|
*
|
|
|
|
*
|
|
|
@ -234,28 +234,27 @@ public class Config {
|
|
|
|
void setReplicatedServersConfig(ReplicatedServersConfig replicatedServersConfig) {
|
|
|
|
void setReplicatedServersConfig(ReplicatedServersConfig replicatedServersConfig) {
|
|
|
|
this.replicatedServersConfig = replicatedServersConfig;
|
|
|
|
this.replicatedServersConfig = replicatedServersConfig;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* Returns the connection manager if supplied via
|
|
|
|
* Returns the connection manager if supplied via
|
|
|
|
* {@link #useCustomServers(ConnectionManager)}
|
|
|
|
* {@link #useCustomServers(ConnectionManager)}
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* @return ConnectionManager
|
|
|
|
* @return ConnectionManager
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
ConnectionManager getConnectionManager() {
|
|
|
|
ConnectionManager getConnectionManager() {
|
|
|
|
return connectionManager;
|
|
|
|
return connectionManager;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* This is an extension point to supply custom connection manager.
|
|
|
|
* This is an extension point to supply custom connection manager.
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* @see ReplicatedConnectionManager on how to implement a connection
|
|
|
|
* @see ReplicatedConnectionManager on how to implement a connection
|
|
|
|
* manager.
|
|
|
|
* manager.
|
|
|
|
* @param connectionManager for supply
|
|
|
|
* @param connectionManager for supply
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
public void useCustomServers(ConnectionManager connectionManager) {
|
|
|
|
public void useCustomServers(ConnectionManager connectionManager) {
|
|
|
|
this.connectionManager = connectionManager;
|
|
|
|
this.connectionManager = connectionManager;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* Init single server configuration.
|
|
|
|
* Init single server configuration.
|
|
|
@ -347,7 +346,7 @@ public class Config {
|
|
|
|
public boolean isClusterConfig() {
|
|
|
|
public boolean isClusterConfig() {
|
|
|
|
return clusterServersConfig != null;
|
|
|
|
return clusterServersConfig != null;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public boolean isSentinelConfig() {
|
|
|
|
public boolean isSentinelConfig() {
|
|
|
|
return sentinelServersConfig != null;
|
|
|
|
return sentinelServersConfig != null;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -415,10 +414,11 @@ public class Config {
|
|
|
|
this.transportMode = transportMode;
|
|
|
|
this.transportMode = transportMode;
|
|
|
|
return this;
|
|
|
|
return this;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public TransportMode getTransportMode() {
|
|
|
|
public TransportMode getTransportMode() {
|
|
|
|
return transportMode;
|
|
|
|
return transportMode;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* Threads amount shared between all redis clients used by Redisson.
|
|
|
|
* Threads amount shared between all redis clients used by Redisson.
|
|
|
|
* <p>
|
|
|
|
* <p>
|
|
|
@ -433,11 +433,11 @@ public class Config {
|
|
|
|
this.nettyThreads = nettyThreads;
|
|
|
|
this.nettyThreads = nettyThreads;
|
|
|
|
return this;
|
|
|
|
return this;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public int getNettyThreads() {
|
|
|
|
public int getNettyThreads() {
|
|
|
|
return nettyThreads;
|
|
|
|
return nettyThreads;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* Use external ExecutorService. ExecutorService processes
|
|
|
|
* Use external ExecutorService. ExecutorService processes
|
|
|
|
* all listeners of <code>RTopic</code>,
|
|
|
|
* all listeners of <code>RTopic</code>,
|
|
|
@ -453,7 +453,7 @@ public class Config {
|
|
|
|
this.executor = executor;
|
|
|
|
this.executor = executor;
|
|
|
|
return this;
|
|
|
|
return this;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public ExecutorService getExecutor() {
|
|
|
|
public ExecutorService getExecutor() {
|
|
|
|
return executor;
|
|
|
|
return executor;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -500,6 +500,7 @@ public class Config {
|
|
|
|
this.lockWatchdogTimeout = lockWatchdogTimeout;
|
|
|
|
this.lockWatchdogTimeout = lockWatchdogTimeout;
|
|
|
|
return this;
|
|
|
|
return this;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public long getLockWatchdogTimeout() {
|
|
|
|
public long getLockWatchdogTimeout() {
|
|
|
|
return lockWatchdogTimeout;
|
|
|
|
return lockWatchdogTimeout;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -519,6 +520,7 @@ public class Config {
|
|
|
|
this.keepPubSubOrder = keepPubSubOrder;
|
|
|
|
this.keepPubSubOrder = keepPubSubOrder;
|
|
|
|
return this;
|
|
|
|
return this;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public boolean isKeepPubSubOrder() {
|
|
|
|
public boolean isKeepPubSubOrder() {
|
|
|
|
return keepPubSubOrder;
|
|
|
|
return keepPubSubOrder;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -534,6 +536,7 @@ public class Config {
|
|
|
|
this.addressResolverGroupFactory = addressResolverGroupFactory;
|
|
|
|
this.addressResolverGroupFactory = addressResolverGroupFactory;
|
|
|
|
return this;
|
|
|
|
return this;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public AddressResolverGroupFactory getAddressResolverGroupFactory() {
|
|
|
|
public AddressResolverGroupFactory getAddressResolverGroupFactory() {
|
|
|
|
return addressResolverGroupFactory;
|
|
|
|
return addressResolverGroupFactory;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -655,7 +658,7 @@ public class Config {
|
|
|
|
public static Config fromYAML(File file) throws IOException {
|
|
|
|
public static Config fromYAML(File file) throws IOException {
|
|
|
|
return fromYAML(file, null);
|
|
|
|
return fromYAML(file, null);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public static Config fromYAML(File file, ClassLoader classLoader) throws IOException {
|
|
|
|
public static Config fromYAML(File file, ClassLoader classLoader) throws IOException {
|
|
|
|
ConfigSupport support = new ConfigSupport();
|
|
|
|
ConfigSupport support = new ConfigSupport();
|
|
|
|
return support.fromYAML(file, Config.class, classLoader);
|
|
|
|
return support.fromYAML(file, Config.class, classLoader);
|
|
|
@ -713,6 +716,7 @@ public class Config {
|
|
|
|
this.useScriptCache = useScriptCache;
|
|
|
|
this.useScriptCache = useScriptCache;
|
|
|
|
return this;
|
|
|
|
return this;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public boolean isUseScriptCache() {
|
|
|
|
public boolean isUseScriptCache() {
|
|
|
|
return useScriptCache;
|
|
|
|
return useScriptCache;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -720,6 +724,7 @@ public class Config {
|
|
|
|
public boolean isDecodeInExecutor() {
|
|
|
|
public boolean isDecodeInExecutor() {
|
|
|
|
return decodeInExecutor;
|
|
|
|
return decodeInExecutor;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* Defines whether to decode data by <code>codec</code> in executor's threads or netty's threads.
|
|
|
|
* Defines whether to decode data by <code>codec</code> in executor's threads or netty's threads.
|
|
|
|
* If decoding data process takes long time and netty thread is used then `RedisTimeoutException` could arise time to time.
|
|
|
|
* If decoding data process takes long time and netty thread is used then `RedisTimeoutException` could arise time to time.
|
|
|
|