mirror of
https://github.com/proxiodev/RedisBungee.git
synced 2026-04-09 00:20:26 +00:00
removed get JedisPool, refactored jedis summoners, new SinglePoolJedisSummoner, start version 0.8.0
This commit is contained in:
@@ -312,11 +312,6 @@ public class RedisBungeeAPI {
|
||||
* @deprecated this secluded to be removed when support for redis sentinel or redis cluster is finished, use {@link RedisBungeeAPI#requestJedis()}
|
||||
* @since 0.6.5
|
||||
*/
|
||||
@Deprecated
|
||||
public JedisPool getJedisPool() {
|
||||
return this.plugin.getJedisPool();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* This gives you instance of Jedis
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.imaginarycode.minecraft.redisbungee.internal;
|
||||
import com.google.common.collect.Multimap;
|
||||
import com.imaginarycode.minecraft.redisbungee.RedisBungeeAPI;
|
||||
import com.imaginarycode.minecraft.redisbungee.internal.util.uuid.UUIDTranslator;
|
||||
import redis.clients.jedis.Jedis;
|
||||
|
||||
import java.net.InetAddress;
|
||||
import java.util.List;
|
||||
@@ -19,16 +20,20 @@ import java.util.concurrent.TimeUnit;
|
||||
* @since 0.7.0
|
||||
*
|
||||
*/
|
||||
public interface RedisBungeePlugin<P> extends JedisSummoner, EventsPlatform{
|
||||
public interface RedisBungeePlugin<P> extends EventsPlatform{
|
||||
|
||||
default void enable() {
|
||||
default void start() {
|
||||
|
||||
}
|
||||
|
||||
default void disable() {
|
||||
default void stop() {
|
||||
|
||||
}
|
||||
|
||||
Jedis requestJedis();
|
||||
|
||||
boolean isJedisAvailable();
|
||||
|
||||
RedisBungeeConfiguration getConfiguration();
|
||||
|
||||
int getCount();
|
||||
|
||||
@@ -1,8 +1,11 @@
|
||||
package com.imaginarycode.minecraft.redisbungee.internal;
|
||||
package com.imaginarycode.minecraft.redisbungee.internal.summoners;
|
||||
|
||||
import redis.clients.jedis.Jedis;
|
||||
import redis.clients.jedis.JedisCluster;
|
||||
import redis.clients.jedis.JedisPool;
|
||||
|
||||
import java.io.Closeable;
|
||||
|
||||
|
||||
/**
|
||||
* This class intended for future release to support redis sentinel or redis clusters
|
||||
@@ -11,13 +14,10 @@ import redis.clients.jedis.JedisPool;
|
||||
* @since 0.7.0
|
||||
*
|
||||
*/
|
||||
public interface JedisSummoner {
|
||||
public interface JedisSummoner extends Closeable {
|
||||
|
||||
Jedis requestJedis();
|
||||
|
||||
boolean isJedisAvailable();
|
||||
|
||||
@Deprecated
|
||||
JedisPool getJedisPool();
|
||||
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
package com.imaginarycode.minecraft.redisbungee.internal.summoners;
|
||||
|
||||
import redis.clients.jedis.Jedis;
|
||||
import redis.clients.jedis.JedisPool;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public class SinglePoolJedisSummoner implements JedisSummoner {
|
||||
final JedisPool jedisPool;
|
||||
|
||||
public SinglePoolJedisSummoner(JedisPool jedisPool) {
|
||||
this.jedisPool = jedisPool;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Jedis requestJedis() {
|
||||
return this.jedisPool.getResource();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isJedisAvailable() {
|
||||
return !this.jedisPool.isClosed();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void close() throws IOException {
|
||||
jedisPool.close();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user