@Override public synchronized void logout() { // get the user id first, because calling terminate may cleanup the security context and loose this information String userID = getUserID(); terminate(true); try { RunningState running = repository.runningState(); long lifetime = Math.abs(System.nanoTime() - this.nanosCreated); Map<String, String> payload = Collections.singletonMap("userId", userID); running.statistics().recordDuration(DurationMetric.SESSION_LIFETIME, lifetime, TimeUnit.NANOSECONDS, payload); running.statistics().decrement(ValueMetric.SESSION_COUNT); running.removeSession(this); } catch (IllegalStateException e) { // The repository has been shutdown } finally { if (bufferMgr != null) { try { bufferMgr.close(); } finally { bufferMgr = null; } } } }
@Override public synchronized void logout() { // get the user id first, because calling terminate may cleanup the security context and loose this information String userID = getUserID(); terminate(true); try { RunningState running = repository.runningState(); long lifetime = Math.abs(System.nanoTime() - this.nanosCreated); Map<String, String> payload = Collections.singletonMap("userId", userID); running.statistics().recordDuration(DurationMetric.SESSION_LIFETIME, lifetime, TimeUnit.NANOSECONDS, payload); running.statistics().decrement(ValueMetric.SESSION_COUNT); running.removeSession(this); } catch (IllegalStateException e) { // The repository has been shutdown } finally { if (bufferMgr != null) { try { bufferMgr.close(); } finally { bufferMgr = null; } } } }
results.add(executors.submit(() -> { repository.runningState().removeSession(locker1); repository.runningState().removeSession(locker2);
repository.runningState().removeSession(locker1);
/** * This method is called by {@link #logout()} and by {@link JcrRepository#shutdown()}. It should not be called from anywhere * else. * * @param removeFromActiveSession true if the session should be removed from the active session list */ void terminate( boolean removeFromActiveSession ) { if (!isLive()) { return; } isLive = false; JcrObservationManager jcrObservationManager = observationManager(); if (jcrObservationManager != null) { jcrObservationManager.removeAllEventListeners(); } cleanLocks(); if (removeFromActiveSession) this.repository.runningState().removeSession(this); this.context.getSecurityContext().logout(); }
/** * This method is called by {@link #logout()} and by {@link JcrRepository#shutdown()}. It should not be called from anywhere * else. * * @param removeFromActiveSession true if the session should be removed from the active session list */ void terminate( boolean removeFromActiveSession ) { if (!isLive()) { return; } isLive = false; JcrObservationManager jcrObservationManager = observationManager(); if (jcrObservationManager != null) { jcrObservationManager.removeAllEventListeners(); } cleanLocks(); if (removeFromActiveSession) this.repository.runningState().removeSession(this); this.context.getSecurityContext().logout(); }