protected List<AbstractSession> filterByUserPrincipal( Collection<AbstractSession> values, Principal userPrincipal) throws IOException { List<AbstractSession> res = null; { if (values != null) { res = new ArrayList<AbstractSession>(); for (AbstractSession session : values) { expandSessionPrincipal(session); } if (userPrincipal == null) { for (AbstractSession session : values) { Principal p = session.getUserPrincipal(); if (p == null) { res.add(session); } } } else { for (AbstractSession session : values) { Principal p = session.getUserPrincipal(); if (PrincipalUtil.equalsIgnoreRealm(userPrincipal, p)) { res.add(session); } } } } } return res; }
public List<String> getSessionIds() throws IOException { List<String> res = null; { synchronized (lookupSessionById) { Set<String> keySet = lookupSessionById.keySet(); if (keySet != null) { res = new ArrayList<String>(); res.addAll(keySet); } } } return res; }
public List<Session> getSessions() throws IOException { List<Session> res = null; { synchronized (lookupSessionById) { Collection<AbstractSession> values = lookupSessionById.values(); if (values != null) { res = new ArrayList<Session>(); for (AbstractSession session : values) { expandSession(session); } res.addAll(values); } } } return res; }