Update commons-pool2 since classloader bugs are fixed

Closes #38
This commit is contained in:
Tux 2016-05-31 06:35:29 -04:00
parent 4707fb79be
commit 436949b8d8
2 changed files with 2 additions and 11 deletions

View File

@ -112,7 +112,7 @@
<dependency> <dependency>
<groupId>org.apache.commons</groupId> <groupId>org.apache.commons</groupId>
<artifactId>commons-pool2</artifactId> <artifactId>commons-pool2</artifactId>
<version>2.3</version> <version>2.4.2</version>
<scope>compile</scope> <scope>compile</scope>
</dependency> </dependency>
<dependency> <dependency>

View File

@ -427,19 +427,10 @@ public final class RedisBungee extends Plugin {
FutureTask<JedisPool> task = new FutureTask<>(new Callable<JedisPool>() { FutureTask<JedisPool> task = new FutureTask<>(new Callable<JedisPool>() {
@Override @Override
public JedisPool call() throws Exception { public JedisPool call() throws Exception {
// With recent versions of Jedis, we must set the classloader to the one BungeeCord used
// to load RedisBungee with.
ClassLoader previous = Thread.currentThread().getContextClassLoader();
Thread.currentThread().setContextClassLoader(RedisBungee.class.getClassLoader());
// Create the pool... // Create the pool...
JedisPoolConfig config = new JedisPoolConfig(); JedisPoolConfig config = new JedisPoolConfig();
config.setMaxTotal(configuration.getInt("max-redis-connections", 8)); config.setMaxTotal(configuration.getInt("max-redis-connections", 8));
JedisPool pool = new JedisPool(config, redisServer, redisPort, 0, finalRedisPassword); return new JedisPool(config, redisServer, redisPort, 0, finalRedisPassword);
// Reset classloader and return the pool
Thread.currentThread().setContextClassLoader(previous);
return pool;
} }
}); });