This commit is contained in:
YuTian 2024-07-22 01:09:31 +08:00
parent f3dd1e2f00
commit 3e6aa0a203

View File

@ -1,7 +1,6 @@
package com.io.yutian.aulib.redis;
import com.io.yutian.aulib.util.FileUtil;
import org.bukkit.Bukkit;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.plugin.Plugin;
@ -12,7 +11,6 @@ import redis.clients.jedis.JedisPoolConfig;
import java.io.File;
import java.time.Duration;
import java.util.Set;
import java.util.concurrent.FutureTask;
public class RedisIO {
@ -32,14 +30,10 @@ public class RedisIO {
}
try {
String finalRedisPassword = redisPassword;
FutureTask<JedisPool> task = new FutureTask<>(() -> {
JedisPoolConfig config = new JedisPoolConfig();
config.setMaxTotal(1024);
config.setMaxWait(Duration.ofMillis(10000));
return new JedisPool(config, redisServer, redisPort, 0, finalRedisPassword);
});
Bukkit.getServer().getScheduler().runTaskAsynchronously(plugin, task);
jedisPool = task.get();
JedisPoolConfig config = new JedisPoolConfig();
config.setMaxTotal(1024);
config.setMaxWait(Duration.ofMillis(10000));
jedisPool = new JedisPool(config, redisServer, redisPort, 0, finalRedisPassword);
} catch (Exception e) {
e.printStackTrace();
}