2
0
mirror of https://github.com/proxiodev/RedisBungee.git synced 2024-11-23 04:28:01 +00:00

It seems this fixes timeout issues

This commit is contained in:
Tux 2014-02-21 18:49:26 -05:00
parent 27b8b09bf3
commit 49ea863da2

View File

@ -7,7 +7,10 @@
package com.imaginarycode.minecraft.redisbungee; package com.imaginarycode.minecraft.redisbungee;
import com.google.common.base.Joiner; import com.google.common.base.Joiner;
import com.google.common.collect.*; import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMultimap;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Multimap;
import com.google.common.io.ByteArrayDataInput; import com.google.common.io.ByteArrayDataInput;
import com.google.common.io.ByteArrayDataOutput; import com.google.common.io.ByteArrayDataOutput;
import com.google.common.io.ByteStreams; import com.google.common.io.ByteStreams;
@ -30,11 +33,13 @@ import redis.clients.jedis.exceptions.JedisException;
import java.io.*; import java.io.*;
import java.net.InetAddress; import java.net.InetAddress;
import java.net.UnknownHostException; import java.net.UnknownHostException;
import java.util.*; import java.util.Collections;
import java.util.List;
import java.util.Set;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import java.util.logging.Level; import java.util.logging.Level;
import static com.google.common.base.Preconditions.*; import static com.google.common.base.Preconditions.checkArgument;
/** /**
* The RedisBungee plugin. * The RedisBungee plugin.
@ -149,7 +154,7 @@ public final class RedisBungee extends Plugin implements Listener {
// Redis server has disappeared! // Redis server has disappeared!
getLogger().log(Level.SEVERE, "Unable to get connection from pool - did your Redis server go away?", e); getLogger().log(Level.SEVERE, "Unable to get connection from pool - did your Redis server go away?", e);
pool.returnBrokenResource(tmpRsc); pool.returnBrokenResource(tmpRsc);
throw new RuntimeException("Unable to get server for "+ name, e); throw new RuntimeException("Unable to get server for " + name, e);
} finally { } finally {
pool.returnResource(tmpRsc); pool.returnResource(tmpRsc);
} }
@ -211,7 +216,7 @@ public final class RedisBungee extends Plugin implements Listener {
// Redis server has disappeared! // Redis server has disappeared!
getLogger().log(Level.SEVERE, "Unable to get connection from pool - did your Redis server go away?", e); getLogger().log(Level.SEVERE, "Unable to get connection from pool - did your Redis server go away?", e);
pool.returnBrokenResource(tmpRsc); pool.returnBrokenResource(tmpRsc);
throw new RuntimeException("Unable to fetch IP address for "+ name, e); throw new RuntimeException("Unable to fetch IP address for " + name, e);
} catch (UnknownHostException ignored) { } catch (UnknownHostException ignored) {
// Best to just return null // Best to just return null
} finally { } finally {
@ -387,7 +392,7 @@ public final class RedisBungee extends Plugin implements Listener {
if (redisServer != null) { if (redisServer != null) {
if (!redisServer.equals("")) { if (!redisServer.equals("")) {
pool = new JedisPool(new JedisPoolConfig(), redisServer, redisPort, Protocol.DEFAULT_TIMEOUT, redisPassword); pool = new JedisPool(new JedisPoolConfig(), redisServer, redisPort, 0, redisPassword);
// Test the connection // Test the connection
Jedis rsc = null; Jedis rsc = null;
try { try {