Code snippet optimization
This commit is contained in:
@@ -40,9 +40,9 @@ public abstract class RedisReactiveConfig {
|
||||
// this should not be changed unless there is a truely good reason to do so
|
||||
private static final int ps = Runtime.getRuntime().availableProcessors();
|
||||
public static final ClientResources clientResources = DefaultClientResources.builder()
|
||||
.ioThreadPoolSize(ps)
|
||||
.computationThreadPoolSize(ps)
|
||||
.build();
|
||||
.ioThreadPoolSize(ps)
|
||||
.computationThreadPoolSize(ps)
|
||||
.build();
|
||||
|
||||
private RedisReactiveProperties redisReactiveProperties;
|
||||
|
||||
@@ -56,7 +56,7 @@ public abstract class RedisReactiveConfig {
|
||||
|
||||
public ReactiveRedisConnectionFactory lettuceConnectionFactory() {
|
||||
|
||||
log.info("connect to " + redisReactiveProperties);
|
||||
log.info("connect to {}", redisReactiveProperties);
|
||||
|
||||
RedisStandaloneConfiguration rcs = new RedisStandaloneConfiguration(redisReactiveProperties.getHost(), redisReactiveProperties.getPort());
|
||||
String password = redisReactiveProperties.getPassword();
|
||||
@@ -65,13 +65,13 @@ public abstract class RedisReactiveConfig {
|
||||
}
|
||||
rcs.setDatabase(redisReactiveProperties.getDatabase());
|
||||
|
||||
GenericObjectPoolConfig poolConfig = new GenericObjectPoolConfig();
|
||||
poolConfig.setMaxTotal(16);
|
||||
GenericObjectPoolConfig<?> poolConfig = new GenericObjectPoolConfig<>();
|
||||
poolConfig.setMaxTotal(poolConfig.getMaxTotal() * 2);
|
||||
LettucePoolingClientConfiguration ccs = LettucePoolingClientConfiguration.builder()
|
||||
.clientResources(clientResources)
|
||||
.clientOptions(ClientOptions.builder().publishOnScheduler(true).build())
|
||||
.poolConfig(poolConfig)
|
||||
.build();
|
||||
.clientResources(clientResources)
|
||||
.clientOptions(ClientOptions.builder().publishOnScheduler(true).build())
|
||||
.poolConfig(poolConfig)
|
||||
.build();
|
||||
|
||||
return new LettuceConnectionFactory(rcs, ccs);
|
||||
}
|
||||
|
||||
@@ -38,50 +38,51 @@ public class Dict {
|
||||
|
||||
public static final int DELETED = 1;
|
||||
|
||||
public int isDeleted = 0;
|
||||
public int isDeleted = 0;
|
||||
|
||||
public int id;
|
||||
public int id;
|
||||
|
||||
public String key;
|
||||
public String key;
|
||||
|
||||
public int type;
|
||||
public int type;
|
||||
|
||||
public String value;
|
||||
public String value;
|
||||
|
||||
public boolean booleanVal;
|
||||
public boolean booleanVal;
|
||||
|
||||
public String stringVal;
|
||||
public String stringVal;
|
||||
|
||||
public BigDecimal numberVal;
|
||||
public BigDecimal numberVal;
|
||||
|
||||
public int intVal;
|
||||
public int intVal;
|
||||
|
||||
public long longVal;
|
||||
public long longVal;
|
||||
|
||||
public float floatVal;
|
||||
public float floatVal;
|
||||
|
||||
public double doubleVal;
|
||||
public double doubleVal;
|
||||
|
||||
public String jsonVal;
|
||||
public String jsonVal;
|
||||
|
||||
public Map<String, Object> valMap;
|
||||
|
||||
public List<Object> valList;
|
||||
public List<Object> valList;
|
||||
|
||||
public long create;
|
||||
public long create;
|
||||
|
||||
public long update;
|
||||
public long update;
|
||||
|
||||
@JsonCreator
|
||||
public Dict(
|
||||
@JsonProperty("isDeleted") int isDeleted,
|
||||
@JsonProperty("id") int id,
|
||||
@JsonProperty("key") String key,
|
||||
@JsonProperty("type") int type,
|
||||
@JsonProperty("value") String value,
|
||||
@JsonProperty("create") long create,
|
||||
@JsonProperty("update") long update
|
||||
) {
|
||||
@JsonProperty("isDeleted") int isDeleted,
|
||||
@JsonProperty("id") int id,
|
||||
@JsonProperty("key") String key,
|
||||
@JsonProperty("type") int type,
|
||||
@JsonProperty("value") String value,
|
||||
@JsonProperty("create") long create,
|
||||
@JsonProperty("update") long update
|
||||
) {
|
||||
|
||||
this.isDeleted = isDeleted;
|
||||
this.id = id;
|
||||
this.key = key;
|
||||
@@ -89,6 +90,7 @@ public class Dict {
|
||||
this.value = value;
|
||||
this.create = create;
|
||||
this.update = update;
|
||||
|
||||
if (type == BOOLEAN) {
|
||||
booleanVal = Boolean.parseBoolean(value);
|
||||
} else if (type == STRING) {
|
||||
|
||||
Reference in New Issue
Block a user