final JcrObservationManager observationManager() { if (observationManager == null && session.isLive()) { try { lock.lock(); if (observationManager == null) { observationManager = new JcrObservationManager(session, repository().changeBus()); } } finally { lock.unlock(); } } return observationManager; }
@Override @SuppressWarnings("deprecation") public String[] getLockTokens() { if (!isLive()) return new String[] {}; return lockManager().getLockTokens(); }
@Override @SuppressWarnings("deprecation") public String[] getLockTokens() { if (!isLive()) return new String[] {}; return lockManager().getLockTokens(); }
final JcrObservationManager observationManager() { if (observationManager == null && session.isLive()) { try { lock.lock(); if (observationManager == null) { observationManager = new JcrObservationManager(session, repository().changeBus()); } } finally { lock.unlock(); } } return observationManager; }
/** * Method that verifies that this session is still {@link #isLive() live}. * * @throws RepositoryException if session has been closed and is no longer usable. */ final void checkLive() throws RepositoryException { if (!isLive()) { throw new RepositoryException(JcrI18n.sessionIsNotActive.text(sessionId())); } }
/** * Method that verifies that this session is still {@link #isLive() live}. * * @throws RepositoryException if session has been closed and is no longer usable. */ final void checkLive() throws RepositoryException { if (!isLive()) { throw new RepositoryException(JcrI18n.sessionIsNotActive.text(sessionId())); } }
@Test public void shouldIndicateLiveBeforeLogout() throws Exception { assertThat(session.isLive(), is(true)); }
@After public void after() throws Exception { if (session != null && session.isLive()) { session.logout(); } }
protected void stopRepository() throws Exception { try { try { if (session != null && session.isLive()) session.logout(); } finally { TestingUtil.killRepositories(repository); } } finally { repository = null; } }
@Test public void shouldAllowShuttingDownAndRestarting() throws Exception { JcrSession session1 = repository.login(); JcrSession session2 = repository.login(); assertThat(session1.isLive(), is(true)); assertThat(session2.isLive(), is(true)); session2.logout(); assertThat(session1.isLive(), is(true)); assertThat(session2.isLive(), is(false)); repository.shutdown().get(3L, TimeUnit.SECONDS); assertThat(session1.isLive(), is(false)); assertThat(session2.isLive(), is(false)); repository.start(); JcrSession session3 = repository.login(); assertThat(session1.isLive(), is(false)); assertThat(session2.isLive(), is(false)); assertThat(session3.isLive(), is(true)); session3.logout(); }
@Test public void shouldIndicateNotLiveAfterLogout() throws Exception { session.logout(); assertThat(session.isLive(), is(false)); }
@Test public void shouldAllowCreationOfSessionForDefaultWorkspaceWithoutUsingCredentials() throws Exception { JcrSession session1 = repository.login(); assertThat(session1.isLive(), is(true)); }
/** * 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(); }
if (inputSession.isLive() && (inputSession == outputSession || outputSession.isLive())) { final long start = System.nanoTime(); stats.increment(ValueMetric.SEQUENCED_COUNT); stats.decrement(ValueMetric.SEQUENCER_QUEUE_SIZE); if (inputSession != null && inputSession.isLive()) inputSession.logout(); if (outputSession != null && outputSession != inputSession && outputSession.isLive()) outputSession.logout();
if (inputSession.isLive() && (inputSession == outputSession || outputSession.isLive())) { final long start = System.nanoTime(); stats.increment(ValueMetric.SEQUENCED_COUNT); stats.decrement(ValueMetric.SEQUENCER_QUEUE_SIZE); if (inputSession != null && inputSession.isLive()) inputSession.logout(); if (outputSession != null && outputSession != inputSession && outputSession.isLive()) outputSession.logout();