principals and sessionIds should be set using constructor so that can be shared across node in cluster
As principals and sessionIds are set in class itself so one can't share user session count across nodes(Cluster). Using constructor for setting principals and sessionIds we can pass Cache map to constructor which can enable common session count in cluster otherwise user would be allowed to logged in with multiple sessions. There is no point keeping principals and sessionIds completely internal.
This commit is contained in:
parent
3d5989dea4
commit
ec723952d5
|
@ -48,13 +48,23 @@ public class SessionRegistryImpl implements SessionRegistry,
|
|||
protected final Log logger = LogFactory.getLog(SessionRegistryImpl.class);
|
||||
|
||||
/** <principal:Object,SessionIdSet> */
|
||||
private final ConcurrentMap<Object, Set<String>> principals = new ConcurrentHashMap<Object, Set<String>>();
|
||||
private final ConcurrentMap<Object, Set<String>> principals;
|
||||
/** <sessionId:Object,SessionInformation> */
|
||||
private final Map<String, SessionInformation> sessionIds = new ConcurrentHashMap<String, SessionInformation>();
|
||||
private final Map<String, SessionInformation> sessionIds;
|
||||
|
||||
// ~ Methods
|
||||
// ========================================================================================================
|
||||
|
||||
public SessionRegistryImpl() {
|
||||
this.principals = new ConcurrentHashMap<Object, Set<String>>();
|
||||
this.sessionIds = new ConcurrentHashMap<String, SessionInformation>();
|
||||
}
|
||||
|
||||
public SessionRegistryImpl(ConcurrentMap<Object, Set<String>> principals,Map<String, SessionInformation> sessionIds) {
|
||||
this.principals=principals;
|
||||
this.sessionIds=sessionIds;
|
||||
}
|
||||
|
||||
public List<Object> getAllPrincipals() {
|
||||
return new ArrayList<Object>(principals.keySet());
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue