public void fillPreviousCQAuth(ClientUserAuths previousClientUserAuths) { for (Iterator<Map.Entry<String, UserAuthAttributes>> iter = previousClientUserAuths.cqNameVsUserAuth.entrySet().iterator(); iter.hasNext();) { Map.Entry<String, UserAuthAttributes> ent = iter.next(); String cqName = ent.getKey(); UserAuthAttributes prevUaa = ent.getValue(); UserAuthAttributes newUaa = this.cqNameVsUserAuth.putIfAbsent(cqName, prevUaa); if (newUaa != null) { previousClientUserAuths.cleanUserAuth(prevUaa); } } } }
public boolean removeUserId(long userId, boolean keepAlive) { UserAuthAttributes uaa = uniqueIdVsUserAuth.get(userId); if (uaa != null && !(uaa.isDurable() && keepAlive)) { uaa = uniqueIdVsUserAuth.remove(userId); logger.debug("UserAuth of {} removed."); if (uaa != null) { cleanUserAuth(uaa); return true; } } return false; }
public void cleanup(boolean fromCacheClientProxy) { for (UserAuthAttributes userAuth : this.uniqueIdVsUserAuth.values()) { // isDurable is checked for multiuser in CQ if (!fromCacheClientProxy && !userAuth.isDurable()) {// from serverConnection class cleanUserAuth(userAuth); } else if (fromCacheClientProxy && userAuth.isDurable()) {// from cacheclientProxy class cleanUserAuth(userAuth); } } // Logout the subjects for (Long subjectId : uniqueIdVsSubject.keySet()) { removeSubject(subjectId); } }
public void setUserAuthAttributesForCq(String cqName, long uniqueId, boolean isDurable) { UserAuthAttributes uaa = this.uniqueIdVsUserAuth.get(uniqueId); if (uaa != null) { if (!isDurable) this.cqNameVsUserAuth.put(cqName, uaa); else { UserAuthAttributes oldUaa = this.cqNameVsUserAuth.put(cqName, uaa); if (oldUaa != null) { if (oldUaa != uaa)// clean earlier one { this.cleanUserAuth(oldUaa); // add durable(increment) uaa.setDurable(); } else { // if looks extra call from client } } else { uaa.setDurable(); } } } }