/** * Return the session identifier for this session. */ public String getId() { return getIdInternal(); }
public org.apache.catalina.Session createSession(java.lang.String sessionId) { StandardSession session = (MongoSession) createEmptySession(); log.fine("Created session with id " + session.getIdInternal() + " ( " + sessionId + ")"); if (sessionId != null) { session.setId(sessionId); } return session; }
public void save(Session session) throws IOException { try { log.fine("Saving session " + session + " into Mongo"); StandardSession standardsession = (MongoSession) session; if (log.isLoggable(Level.FINE)) { log.fine("Session Contents [" + session.getId() + "]:"); for (Object name : Collections.list(standardsession.getAttributeNames())) { log.fine(" " + name); } } byte[] data = serializer.serializeFrom(standardsession); BasicDBObject dbsession = new BasicDBObject(); dbsession.put("_id", standardsession.getId()); dbsession.put("data", data); dbsession.put("lastmodified", System.currentTimeMillis()); BasicDBObject query = new BasicDBObject(); query.put("_id", standardsession.getIdInternal()); getCollection().update(query, dbsession, true, false); log.fine("Updated session with id " + session.getIdInternal()); } catch (IOException e) { log.severe(e.getMessage()); e.printStackTrace(); throw e; } finally { currentSession.remove(); log.fine("Session removed from ThreadLocal :" + session.getIdInternal()); } }
if (timeIdle > maxIdleSwap && timeIdle > minIdleSwap) { if (log.isLoggable(Level.FINE)) { log.log(Level.FINE, LogFacade.SWAPPING_SESSION_TO_STORE, new Object[] {session.getIdInternal(), Integer.valueOf(timeIdle)});
log.debug(sm.getString ("persistentManager.swapMaxIdle", session.getIdInternal(), new Integer(timeIdle))); try { swapOut(session);
/** * Back up idle sessions. */ protected void processMaxIdleBackups() { if (!isStarted() || maxIdleBackup < 0) return; Session sessions[] = findSessions(); long timeNow = System.currentTimeMillis(); // Back up all sessions idle longer than maxIdleBackup if (maxIdleBackup >= 0) { for (int i = 0; i < sessions.length; i++) { StandardSession session = (StandardSession) sessions[i]; if (!session.isValid()) continue; int timeIdle = // Truncate, do not round up (int) ((timeNow - session.getLastAccessedTime()) / 1000L); if (timeIdle > maxIdleBackup) { if (log.isDebugEnabled()) log.debug(sm.getString ("persistentManager.backupMaxIdle", session.getIdInternal(), new Integer(timeIdle))); try { writeSession(session); } catch (IOException e) { ; // This is logged in writeSession() } } } } }
log.debug(sm.getString ("persistentManager.swapMaxIdle", session.getIdInternal(), new Integer(timeIdle))); try { swapOut(session);
log.debug(sm.getString ("persistentManager.backupMaxIdle", session.getIdInternal(), new Integer(timeIdle)));
CatalinaLogger.SESSION_LOGGER.sessionSwapOut(session.getIdInternal(), timeIdle); try { swapOut(session);
/** * Back up idle sessions. */ protected void processMaxIdleBackups() { if (!isStarted() || maxIdleBackup < 0) return; Session sessions[] = findSessions(); long timeNow = System.currentTimeMillis(); // Back up all sessions idle longer than maxIdleBackup if (maxIdleBackup >= 0) { for (int i = 0; i < sessions.length; i++) { StandardSession session = (StandardSession) sessions[i]; synchronized (session) { if (!session.isValid()) continue; int timeIdle = // Truncate, do not round up (int) ((timeNow - session.getLastAccessedTime()) / 1000L); if (timeIdle > maxIdleBackup) { CatalinaLogger.SESSION_LOGGER.persistentManagerBackupSession(session.getIdInternal(), timeIdle); try { writeSession(session); } catch (IOException e) { ; // This is logged in writeSession() } } } } } }
log.debug(sm.getString ("persistentManager.swapMaxIdle", session.getIdInternal(), Integer.valueOf(timeIdle))); try {
log.debug(sm.getString ("persistentManager.swapMaxIdle", session.getIdInternal(), Integer.valueOf(timeIdle))); try {
log.debug(sm.getString ("persistentManager.backupMaxIdle", session.getIdInternal(), Integer.valueOf(timeIdle)));
log.debug(sm.getString ("persistentManager.backupMaxIdle", session.getIdInternal(), Integer.valueOf(timeIdle)));
log.debug(sm.getString ("persistentManager.backupMaxIdle", session.getIdInternal(), Integer.valueOf(timeIdle)));
log.debug(sm.getString ("persistentManager.backupMaxIdle", session.getIdInternal(), Integer.valueOf(timeIdle)));
log.debug(sm.getString ("persistentManager.swapMaxIdle", session.getIdInternal(), Integer.valueOf(timeIdle))); try {
log.debug(sm.getString ("persistentManager.backupMaxIdle", session.getIdInternal(), Integer.valueOf(timeIdle)));
log.debug(sm.getString ("persistentManager.swapTooManyActive", session.getIdInternal(), Integer.valueOf(timeIdle))); try {
log.debug(sm.getString ("persistentManager.swapTooManyActive", session.getIdInternal(), Integer.valueOf(timeIdle))); try {