diff --git a/redisson-tomcat/redisson-tomcat-6/src/main/java/org/redisson/tomcat/RedissonSessionManager.java b/redisson-tomcat/redisson-tomcat-6/src/main/java/org/redisson/tomcat/RedissonSessionManager.java index 65dd81ac2..ccf7b9411 100644 --- a/redisson-tomcat/redisson-tomcat-6/src/main/java/org/redisson/tomcat/RedissonSessionManager.java +++ b/redisson-tomcat/redisson-tomcat-6/src/main/java/org/redisson/tomcat/RedissonSessionManager.java @@ -162,6 +162,12 @@ public class RedissonSessionManager extends ManagerBase implements Lifecycle { @Override public void start() throws LifecycleException { + redisson = buildClient(); + + lifecycle.fireLifecycleEvent(START_EVENT, null); + } + + protected RedissonClient buildClient() throws LifecycleException { Config config = null; try { config = Config.fromJSON(new File(configPath), getClass().getClassLoader()); @@ -176,12 +182,10 @@ public class RedissonSessionManager extends ManagerBase implements Lifecycle { } try { - redisson = Redisson.create(config); + return Redisson.create(config); } catch (Exception e) { throw new LifecycleException(e); } - - lifecycle.fireLifecycleEvent(START_EVENT, null); } @Override diff --git a/redisson-tomcat/redisson-tomcat-7/src/main/java/org/redisson/tomcat/RedissonSessionManager.java b/redisson-tomcat/redisson-tomcat-7/src/main/java/org/redisson/tomcat/RedissonSessionManager.java index 45f87b10d..1af366e72 100644 --- a/redisson-tomcat/redisson-tomcat-7/src/main/java/org/redisson/tomcat/RedissonSessionManager.java +++ b/redisson-tomcat/redisson-tomcat-7/src/main/java/org/redisson/tomcat/RedissonSessionManager.java @@ -143,6 +143,13 @@ public class RedissonSessionManager extends ManagerBase { @Override protected void startInternal() throws LifecycleException { super.startInternal(); + + redisson = buildClient(); + + setState(LifecycleState.STARTING); + } + + protected RedissonClient buildClient() throws LifecycleException { Config config = null; try { config = Config.fromJSON(new File(configPath), getClass().getClassLoader()); @@ -166,12 +173,10 @@ public class RedissonSessionManager extends ManagerBase { throw new IllegalStateException("Unable to initialize codec with ClassLoader parameter", e); } - redisson = Redisson.create(config); + return Redisson.create(config); } catch (Exception e) { throw new LifecycleException(e); } - - setState(LifecycleState.STARTING); } @Override diff --git a/redisson-tomcat/redisson-tomcat-8/src/main/java/org/redisson/tomcat/RedissonSessionManager.java b/redisson-tomcat/redisson-tomcat-8/src/main/java/org/redisson/tomcat/RedissonSessionManager.java index 21f71bfea..c170335f7 100644 --- a/redisson-tomcat/redisson-tomcat-8/src/main/java/org/redisson/tomcat/RedissonSessionManager.java +++ b/redisson-tomcat/redisson-tomcat-8/src/main/java/org/redisson/tomcat/RedissonSessionManager.java @@ -144,6 +144,12 @@ public class RedissonSessionManager extends ManagerBase { @Override protected void startInternal() throws LifecycleException { super.startInternal(); + redisson = buildClient(); + + setState(LifecycleState.STARTING); + } + + protected RedissonClient buildClient() throws LifecycleException { Config config = null; try { config = Config.fromJSON(new File(configPath), getClass().getClassLoader()); @@ -163,12 +169,10 @@ public class RedissonSessionManager extends ManagerBase { .newInstance(Thread.currentThread().getContextClassLoader()); config.setCodec(codec); - redisson = Redisson.create(config); + return Redisson.create(config); } catch (Exception e) { throw new LifecycleException(e); } - - setState(LifecycleState.STARTING); } @Override