Skip to content

Commit

Permalink
WebFilter cleanup.
Browse files Browse the repository at this point in the history
  • Loading branch information
mdogan committed Apr 12, 2012
1 parent fcb299e commit 1e6a4ee
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions hazelcast-wm/src/main/java/com/hazelcast/web/WebFilter.java
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public class WebFilter implements Filter {
public WebFilter() {
}

public void init(final FilterConfig config) throws ServletException {
public final void init(final FilterConfig config) throws ServletException {
String debugParam = config.getInitParameter("debug");
if (debugParam != null) {
debug = Boolean.valueOf(debugParam);
Expand Down Expand Up @@ -111,7 +111,7 @@ public void entryEvicted(EntryEvent entryEvent) {
+ ", map-name: " + clusterMapName);
}

void removeSessionLocally(String sessionId) {
private void removeSessionLocally(String sessionId) {
HazelcastHttpSession hazelSession = mapSessions.remove(sessionId);
if (hazelSession != null) {
mapOriginalSessions.remove(hazelSession.originalSession.getId());
Expand All @@ -120,14 +120,14 @@ void removeSessionLocally(String sessionId) {
}
}

void markSessionDirty(String sessionId) {
private void markSessionDirty(String sessionId) {
HazelcastHttpSession hazelSession = mapSessions.get(sessionId);
if (hazelSession != null) {
hazelSession.setDirty(true);
}
}

public static void destroyOriginalSession(HttpSession originalSession) {
static void destroyOriginalSession(HttpSession originalSession) {
String hazelcastSessionId = mapOriginalSessions.remove(originalSession.getId());
if (hazelcastSessionId != null) {
HazelcastHttpSession hazelSession = mapSessions.remove(hazelcastSessionId);
Expand All @@ -137,15 +137,15 @@ public static void destroyOriginalSession(HttpSession originalSession) {
}
}

void log(final Object obj) {
protected void log(final Object obj) {
Level level = Level.FINEST;
if (debug) {
level = Level.INFO;
}
logger.log(level, obj.toString());
}

HazelcastHttpSession createNewSession(RequestWrapper requestWrapper, String existingSessionId) {
private HazelcastHttpSession createNewSession(RequestWrapper requestWrapper, String existingSessionId) {
String id = existingSessionId != null ? existingSessionId : generateSessionId();
if (requestWrapper.getOriginalSession(false) != null) {
log("Original session exists!!!");
Expand All @@ -169,7 +169,7 @@ HazelcastHttpSession createNewSession(RequestWrapper requestWrapper, String exis
* @param session The session to be destroyed
* @param ignoreTimeout Boolean value - true if the session should be destroyed irrespective of active time
*/
void destroySession(final HazelcastHttpSession session, final Boolean ignoreTimeout) {
private void destroySession(final HazelcastHttpSession session, final Boolean ignoreTimeout) {
log("Destroying local session: " + session.getId());
mapSessions.remove(session.getId());
mapOriginalSessions.remove(session.originalSession.getId());
Expand All @@ -192,11 +192,11 @@ void destroySession(final HazelcastHttpSession session, final Boolean ignoreTime
}
}

protected IMap getClusterMap() {
private IMap getClusterMap() {
return hazelcastInstance.getMap(clusterMapName);
}

HazelcastHttpSession getSessionWithId(final String sessionId) {
private HazelcastHttpSession getSessionWithId(final String sessionId) {
HazelcastHttpSession session = mapSessions.get(sessionId);
if (session != null && !session.isValid()) {
session = null;
Expand All @@ -205,7 +205,7 @@ HazelcastHttpSession getSessionWithId(final String sessionId) {
return session;
}

class RequestWrapper extends HttpServletRequestWrapper {
private class RequestWrapper extends HttpServletRequestWrapper {
HazelcastHttpSession hazelcastSession = null;

final ResponseWrapper res;
Expand Down Expand Up @@ -324,7 +324,7 @@ private void overrideSession(HazelcastHttpSession session, Map mapSession) {
}
} // END of RequestWrapper

class ResponseWrapper extends HttpServletResponseWrapper {
private class ResponseWrapper extends HttpServletResponseWrapper {

RequestWrapper req = null;

Expand Down Expand Up @@ -519,7 +519,7 @@ private String getSessionCookie(final RequestWrapper req) {
return null;
}

public void doFilter(ServletRequest req, ServletResponse res, final FilterChain chain)
public final void doFilter(ServletRequest req, ServletResponse res, final FilterChain chain)
throws IOException, ServletException {
if (!(req instanceof HttpServletRequest)) {
chain.doFilter(req, res);
Expand Down Expand Up @@ -570,7 +570,7 @@ public void doFilter(ServletRequest req, ServletResponse res, final FilterChain
}
}

public void destroy() {
public final void destroy() {
mapSessions.clear();
mapOriginalSessions.clear();
shutdownInstance();
Expand Down

0 comments on commit 1e6a4ee

Please sign in to comment.