parent
82fb1baa19
commit
bbb4023689
10
pom.xml
10
pom.xml
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
<groupId>tomcat-cluster-redis-session-manager</groupId>
|
<groupId>tomcat-cluster-redis-session-manager</groupId>
|
||||||
<artifactId>tomcat-cluster-redis-session-manager</artifactId>
|
<artifactId>tomcat-cluster-redis-session-manager</artifactId>
|
||||||
<version>3.0.3</version>
|
<version>3.0.2</version>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<name>tomcat-cluster-redis-session-manager</name>
|
<name>tomcat-cluster-redis-session-manager</name>
|
||||||
|
@ -17,7 +17,7 @@
|
||||||
|
|
||||||
<jedis.version>3.0.1</jedis.version>
|
<jedis.version>3.0.1</jedis.version>
|
||||||
<commons-pool2.version>2.6.2</commons-pool2.version>
|
<commons-pool2.version>2.6.2</commons-pool2.version>
|
||||||
<commons-logging.version>1.2</commons-logging.version>
|
<slf4j-api.version>1.7.26</slf4j-api.version>
|
||||||
|
|
||||||
<maven-compiler.version>3.6.1</maven-compiler.version>
|
<maven-compiler.version>3.6.1</maven-compiler.version>
|
||||||
<source-java.version>1.7</source-java.version>
|
<source-java.version>1.7</source-java.version>
|
||||||
|
@ -42,9 +42,9 @@
|
||||||
<version>${commons-pool2.version}</version>
|
<version>${commons-pool2.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>commons-logging</groupId>
|
<groupId>org.slf4j</groupId>
|
||||||
<artifactId>commons-logging</artifactId>
|
<artifactId>slf4j-api</artifactId>
|
||||||
<version>${commons-logging.version}</version>
|
<version>${slf4j-api.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- For local development dependency begins.. -->
|
<!-- For local development dependency begins.. -->
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package tomcat.request.session.data.cache;
|
package tomcat.request.session.data.cache;
|
||||||
|
|
||||||
import org.apache.commons.logging.Log;
|
import org.slf4j.Logger;
|
||||||
import org.apache.commons.logging.LogFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import tomcat.request.session.SessionConstants;
|
import tomcat.request.session.SessionConstants;
|
||||||
import tomcat.request.session.data.cache.impl.StandardDataCache;
|
import tomcat.request.session.data.cache.impl.StandardDataCache;
|
||||||
import tomcat.request.session.data.cache.impl.redis.RedisCache;
|
import tomcat.request.session.data.cache.impl.redis.RedisCache;
|
||||||
|
@ -15,7 +15,7 @@ import java.util.Properties;
|
||||||
/** author: Ranjith Manickam @ 3 Dec' 2018 */
|
/** author: Ranjith Manickam @ 3 Dec' 2018 */
|
||||||
public class DataCacheFactory {
|
public class DataCacheFactory {
|
||||||
|
|
||||||
private static final Log LOGGER = LogFactory.getLog(DataCacheFactory.class);
|
private static final Logger LOGGER = LoggerFactory.getLogger(DataCacheFactory.class);
|
||||||
|
|
||||||
private final int sessionExpiryTime;
|
private final int sessionExpiryTime;
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package tomcat.request.session.data.cache.impl;
|
package tomcat.request.session.data.cache.impl;
|
||||||
|
|
||||||
import org.apache.commons.logging.Log;
|
import org.slf4j.Logger;
|
||||||
import org.apache.commons.logging.LogFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import tomcat.request.session.data.cache.DataCache;
|
import tomcat.request.session.data.cache.DataCache;
|
||||||
import tomcat.request.session.data.cache.DataCacheConstants;
|
import tomcat.request.session.data.cache.DataCacheConstants;
|
||||||
import tomcat.request.session.data.cache.DataCacheFactory;
|
import tomcat.request.session.data.cache.DataCacheFactory;
|
||||||
|
@ -159,7 +159,7 @@ public class StandardDataCache extends RedisCache {
|
||||||
/** Session data redis sync thread. */
|
/** Session data redis sync thread. */
|
||||||
private class SessionDataSyncThread implements Runnable {
|
private class SessionDataSyncThread implements Runnable {
|
||||||
|
|
||||||
private final Log LOGGER = LogFactory.getLog(SessionDataSyncThread.class);
|
private final Logger LOGGER = LoggerFactory.getLogger(SessionDataSyncThread.class);
|
||||||
|
|
||||||
private final DataCache dataCache;
|
private final DataCache dataCache;
|
||||||
private final int sessionExpiryTime;
|
private final int sessionExpiryTime;
|
||||||
|
@ -192,7 +192,7 @@ public class StandardDataCache extends RedisCache {
|
||||||
/** Session data expiry thread. This will takes care of the session expired data removal. */
|
/** Session data expiry thread. This will takes care of the session expired data removal. */
|
||||||
private class SessionDataExpiryThread implements Runnable {
|
private class SessionDataExpiryThread implements Runnable {
|
||||||
|
|
||||||
private final Log LOGGER = LogFactory.getLog(SessionDataExpiryThread.class);
|
private final Logger LOGGER = LoggerFactory.getLogger(SessionDataExpiryThread.class);
|
||||||
|
|
||||||
private final long expiry;
|
private final long expiry;
|
||||||
private final Map<String, SessionData> sessionData;
|
private final Map<String, SessionData> sessionData;
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package tomcat.request.session.data.cache.impl.redis;
|
package tomcat.request.session.data.cache.impl.redis;
|
||||||
|
|
||||||
import org.apache.commons.logging.Log;
|
import org.slf4j.Logger;
|
||||||
import org.apache.commons.logging.LogFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import redis.clients.jedis.Jedis;
|
import redis.clients.jedis.Jedis;
|
||||||
import redis.clients.jedis.exceptions.JedisConnectionException;
|
import redis.clients.jedis.exceptions.JedisConnectionException;
|
||||||
import redis.clients.jedis.util.Pool;
|
import redis.clients.jedis.util.Pool;
|
||||||
|
@ -12,7 +12,7 @@ import tomcat.request.session.data.cache.DataCacheConstants;
|
||||||
abstract class RedisManager implements DataCache {
|
abstract class RedisManager implements DataCache {
|
||||||
|
|
||||||
private static final int NUM_RETRIES = 3;
|
private static final int NUM_RETRIES = 3;
|
||||||
private static final Log LOGGER = LogFactory.getLog(RedisManager.class);
|
private static final Logger LOGGER = LoggerFactory.getLogger(RedisManager.class);
|
||||||
|
|
||||||
private final Pool<Jedis> pool;
|
private final Pool<Jedis> pool;
|
||||||
private final long failiureWaitTime;
|
private final long failiureWaitTime;
|
||||||
|
|
|
@ -3,8 +3,8 @@ package tomcat.request.session.redis;
|
||||||
import org.apache.catalina.connector.Request;
|
import org.apache.catalina.connector.Request;
|
||||||
import org.apache.catalina.connector.Response;
|
import org.apache.catalina.connector.Response;
|
||||||
import org.apache.catalina.valves.ValveBase;
|
import org.apache.catalina.valves.ValveBase;
|
||||||
import org.apache.commons.logging.Log;
|
import org.slf4j.Logger;
|
||||||
import org.apache.commons.logging.LogFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import tomcat.request.session.exception.BackendException;
|
import tomcat.request.session.exception.BackendException;
|
||||||
|
|
||||||
import javax.servlet.ServletException;
|
import javax.servlet.ServletException;
|
||||||
|
@ -13,7 +13,7 @@ import java.io.IOException;
|
||||||
/** author: Ranjith Manickam @ 12 Jul' 2018 */
|
/** author: Ranjith Manickam @ 12 Jul' 2018 */
|
||||||
public class SessionHandlerValve extends ValveBase {
|
public class SessionHandlerValve extends ValveBase {
|
||||||
|
|
||||||
private static final Log LOGGER = LogFactory.getLog(SessionHandlerValve.class);
|
private static final Logger LOGGER = LoggerFactory.getLogger(SessionHandlerValve.class);
|
||||||
|
|
||||||
private SessionManager manager;
|
private SessionManager manager;
|
||||||
|
|
||||||
|
|
|
@ -7,8 +7,8 @@ import org.apache.catalina.LifecycleListener;
|
||||||
import org.apache.catalina.LifecycleState;
|
import org.apache.catalina.LifecycleState;
|
||||||
import org.apache.catalina.Valve;
|
import org.apache.catalina.Valve;
|
||||||
import org.apache.catalina.session.ManagerBase;
|
import org.apache.catalina.session.ManagerBase;
|
||||||
import org.apache.commons.logging.Log;
|
import org.slf4j.Logger;
|
||||||
import org.apache.commons.logging.LogFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import tomcat.request.session.SerializationUtil;
|
import tomcat.request.session.SerializationUtil;
|
||||||
import tomcat.request.session.Session;
|
import tomcat.request.session.Session;
|
||||||
import tomcat.request.session.SessionConstants;
|
import tomcat.request.session.SessionConstants;
|
||||||
|
@ -33,7 +33,7 @@ public class SessionManager extends ManagerBase implements Lifecycle {
|
||||||
private ThreadLocal<SessionContext> sessionContext = new ThreadLocal<>();
|
private ThreadLocal<SessionContext> sessionContext = new ThreadLocal<>();
|
||||||
private Set<SessionPolicy> sessionPolicy = EnumSet.of(SessionPolicy.DEFAULT);
|
private Set<SessionPolicy> sessionPolicy = EnumSet.of(SessionPolicy.DEFAULT);
|
||||||
|
|
||||||
private static final Log LOGGER = LogFactory.getLog(SessionManager.class);
|
private static final Logger LOGGER = LoggerFactory.getLogger(SessionManager.class);
|
||||||
|
|
||||||
public boolean getSaveOnChange() {
|
public boolean getSaveOnChange() {
|
||||||
return this.sessionPolicy.contains(SessionPolicy.SAVE_ON_CHANGE);
|
return this.sessionPolicy.contains(SessionPolicy.SAVE_ON_CHANGE);
|
||||||
|
|
Loading…
Reference in New Issue