diff --git a/src/main/java/com/radiadesign/catalina/session/RedisSession.java b/src/main/java/com/radiadesign/catalina/session/RedisSession.java index fde1fdff..f776987b 100644 --- a/src/main/java/com/radiadesign/catalina/session/RedisSession.java +++ b/src/main/java/com/radiadesign/catalina/session/RedisSession.java @@ -4,8 +4,6 @@ import org.apache.catalina.Manager; import org.apache.catalina.session.StandardSession; import java.util.HashMap; -import javax.servlet.ServletException; -import java.io.IOException; import java.util.logging.Logger; @@ -46,6 +44,7 @@ public void resetDirtyTracking() { dirty = false; } + @Override public void setAttribute(String key, Object value) { if (manualDirtyTrackingSupportEnabled && manualDirtyTrackingAttributeKey.equals(key)) { dirty = true; @@ -63,6 +62,7 @@ public void setAttribute(String key, Object value) { super.setAttribute(key, value); } + @Override public void removeAttribute(String name) { dirty = true; super.removeAttribute(name); @@ -72,10 +72,11 @@ public void removeAttribute(String name) { public void setId(String id) { // Specifically do not call super(): it's implementation does unexpected things // like calling manager.remove(session.id) and manager.add(session). - + this.id = id; } + @Override public void setPrincipal(Principal principal) { dirty = true; super.setPrincipal(principal); diff --git a/src/main/java/com/radiadesign/catalina/session/RedisSessionManager.java b/src/main/java/com/radiadesign/catalina/session/RedisSessionManager.java index 04a94833..13a7bbed 100644 --- a/src/main/java/com/radiadesign/catalina/session/RedisSessionManager.java +++ b/src/main/java/com/radiadesign/catalina/session/RedisSessionManager.java @@ -1,6 +1,5 @@ package com.radiadesign.catalina.session; -import org.apache.catalina.Globals; import org.apache.catalina.Lifecycle; import org.apache.catalina.LifecycleException; import org.apache.catalina.LifecycleListener; @@ -17,10 +16,9 @@ import redis.clients.jedis.Protocol; import java.io.IOException; -import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; -import java.util.List; +import java.util.Enumeration; import java.util.Set; import org.apache.juli.logging.Log; @@ -99,6 +97,7 @@ public void setSerializationStrategyClass(String strategy) { this.serializationStrategyClass = strategy; } + @Override public int getRejectedSessions() { // Essentially do nothing. return 0; @@ -130,10 +129,12 @@ protected void returnConnection(Jedis jedis) { returnConnection(jedis, false); } + @Override public void load() throws ClassNotFoundException, IOException { } + @Override public void unload() throws IOException { } @@ -143,6 +144,7 @@ public void unload() throws IOException { * * @param listener The listener to add */ + @Override public void addLifecycleListener(LifecycleListener listener) { lifecycle.addLifecycleListener(listener); } @@ -151,6 +153,7 @@ public void addLifecycleListener(LifecycleListener listener) { * Get the lifecycle listeners associated with this lifecycle. If this * Lifecycle has no listeners registered, a zero-length array is returned. */ + @Override public LifecycleListener[] findLifecycleListeners() { return lifecycle.findLifecycleListeners(); } @@ -161,6 +164,7 @@ public LifecycleListener[] findLifecycleListeners() { * * @param listener The listener to remove */ + @Override public void removeLifecycleListener(LifecycleListener listener) { lifecycle.removeLifecycleListener(listener); } @@ -406,8 +410,9 @@ public RedisSession loadSessionFromRedis(String id) throws IOException { if (log.isTraceEnabled()) { log.trace("Session Contents [" + id + "]:"); - for (Object name : Collections.list(session.getAttributeNames())) { - log.trace(" " + name); + Enumeration en = session.getAttributeNames(); + while(en.hasMoreElements()) { + log.trace(" " + en.nextElement()); } } } @@ -437,8 +442,9 @@ public void save(Session session) throws IOException { if (log.isTraceEnabled()) { log.trace("Session Contents [" + redisSession.getId() + "]:"); - for (Object name : Collections.list(redisSession.getAttributeNames())) { - log.trace(" " + name); + Enumeration en = redisSession.getAttributeNames(); + while(en.hasMoreElements()) { + log.trace(" " + en.nextElement()); } } @@ -470,10 +476,12 @@ public void save(Session session) throws IOException { } } + @Override public void remove(Session session) { remove(session, false); } + @Override public void remove(Session session, boolean update) { Jedis jedis = null; Boolean error = true;