String sessionId = (String) iter.next(); SessionInformation sessionInformation = getSessionInformation(sessionId); if (!sessionInformation.isExpired()) { list.add(sessionInformation); }
synchronized (sessionsUsedByPrincipal) { String sessionId = (String) iter.next(); SessionInformation sessionInformation = getSessionInformation(sessionId);  if (!sessionInformation.isExpired()) { list.add(sessionInformation); } }
    public SessionInformation[] getAllSessions(Object principal) {        Set sessionsUsedByPrincipal = (Set) principals.get(principal);        if (sessionsUsedByPrincipal == null) {            return null;        }                List list = new ArrayList();        Iterator iter = sessionsUsedByPrincipal.iterator();        while (iter.hasNext()) {        	String sessionId = (String) iter.next();        	SessionInformation sessionInformation = getSessionInformation(sessionId);        	if (!sessionInformation.isExpired()) {            	list.add(sessionInformation);        	}        }        return (SessionInformation[]) list.toArray(new SessionInformation[] {});    }