Search in sources :

Example 1 with MapSession

use of com.networknt.session.MapSession in project light-session-4j by networknt.

the class JdbcSessionRepository method extractData.

public List<JdbcSession> extractData(ResultSet rs) throws SQLException {
    List<JdbcSession> sessions = new ArrayList<>();
    while (rs.next()) {
        String id = rs.getString("SESSION_ID");
        JdbcSession session;
        if (sessions.size() > 0 && getLast(sessions).getId().equals(id)) {
            session = getLast(sessions);
        } else {
            MapSession delegate = new MapSession(rs.getString("SESSION_ID"));
            delegate.setMaxInactiveInterval(rs.getInt("MAX_INACTIVE_INTERVAL"));
            delegate.setCreationTime(rs.getLong("CREATION_TIME"));
            delegate.setLastAccessedTime(rs.getLong("LAST_ACCESS_TIME"));
            session = new JdbcSession(delegate);
        }
        String attributeName = rs.getString("ATTRIBUTE_NAME");
        if (attributeName != null) {
            session.setAttribute(attributeName, deserialize(rs, "ATTRIBUTE_BYTES"));
        }
        sessions.add(session);
    }
    return sessions;
}
Also used : MapSession(com.networknt.session.MapSession)

Aggregations

MapSession (com.networknt.session.MapSession)1