Made session maps final in SessionRegistryImpl.

This commit is contained in:
Luke Taylor 2009-12-08 01:33:01 +00:00
parent 558737363f
commit 33b109f0b3

View File

@ -34,27 +34,26 @@ import org.springframework.util.Assert;
* Base implementation of {@link org.springframework.security.core.session.SessionRegistry} * Base implementation of {@link org.springframework.security.core.session.SessionRegistry}
* which also listens for {@link org.springframework.security.web.session.HttpSessionDestroyedEvent}s * which also listens for {@link org.springframework.security.web.session.HttpSessionDestroyedEvent}s
* published in the Spring application context. * published in the Spring application context.
*
* <p> * <p>
* NB: It is important that you register the {@link org.springframework.security.web.session.HttpSessionEventPublisher} in * NB: It is important that you register the {@link org.springframework.security.web.session.HttpSessionEventPublisher}
* <code>web.xml</code> so that this class is notified of sessions that expire. * in <code>web.xml</code> so that this class is notified of sessions that expire.
* *
* @author Ben Alex * @author Ben Alex
* @author Luke Taylor
* @version $Id$ * @version $Id$
*/ */
public class SessionRegistryImpl implements SessionRegistry, ApplicationListener<SessionDestroyedEvent> { public class SessionRegistryImpl implements SessionRegistry, ApplicationListener<SessionDestroyedEvent> {
//~ Static fields/initializers =====================================================================================
protected static final Log logger = LogFactory.getLog(SessionRegistryImpl.class); //~ Instance fields ================================================================================================
// ~ Instance fields =============================================================================================== protected final Log logger = LogFactory.getLog(SessionRegistryImpl.class);
/** <principal:Object,SessionIdSet> */ /** <principal:Object,SessionIdSet> */
private Map<Object,Set<String>> principals = Collections.synchronizedMap(new HashMap<Object,Set<String>>()); private final Map<Object,Set<String>> principals = Collections.synchronizedMap(new HashMap<Object,Set<String>>());
/** <sessionId:Object,SessionInformation> */ /** <sessionId:Object,SessionInformation> */
private Map<String, SessionInformation> sessionIds = Collections.synchronizedMap(new HashMap<String, SessionInformation>()); private final Map<String, SessionInformation> sessionIds = Collections.synchronizedMap(new HashMap<String, SessionInformation>());
// ~ Methods ======================================================================================================= //~ Methods ========================================================================================================
public List<Object> getAllPrincipals() { public List<Object> getAllPrincipals() {
return Arrays.asList(principals.keySet().toArray()); return Arrays.asList(principals.keySet().toArray());