/** * Return the active Session, associated with this Manager, with the * specified session id (if any); otherwise return <code>null</code>. * * @param id * The session id for the session to be returned * @return the session or <code>null</code> if no session was found locally * or in memcached. * * @exception IllegalStateException * if a new session cannot be instantiated for any reason * @exception IOException * if an input/output error occurs while processing this * request */ @Override public Session findSession( final String id ) throws IOException { return _msm.findSession( id ); }
/** * Return the active Session, associated with this Manager, with the * specified session id (if any); otherwise return <code>null</code>. * * @param id * The session id for the session to be returned * @return the session or <code>null</code> if no session was found locally * or in memcached. * * @exception IllegalStateException * if a new session cannot be instantiated for any reason * @exception IOException * if an input/output error occurs while processing this * request */ @Override public Session findSession( final String id ) throws IOException { return _msm.findSession( id ); }
/** * Return the active Session, associated with this Manager, with the * specified session id (if any); otherwise return <code>null</code>. * * @param id * The session id for the session to be returned * @return the session or <code>null</code> if no session was found locally * or in memcached. * * @exception IllegalStateException * if a new session cannot be instantiated for any reason * @exception IOException * if an input/output error occurs while processing this * request */ @Override public Session findSession( final String id ) throws IOException { return _msm.findSession( id ); }
/** * Return the active Session, associated with this Manager, with the * specified session id (if any); otherwise return <code>null</code>. * * @param id * The session id for the session to be returned * @return the session or <code>null</code> if no session was found locally * or in memcached. * * @exception IllegalStateException * if a new session cannot be instantiated for any reason * @exception IOException * if an input/output error occurs while processing this * request */ @Override public Session findSession( final String id ) throws IOException { return _msm.findSession( id ); }
@Override public MemcachedBackupSession findSession( final String id ) throws IOException { final MemcachedBackupSession result = super.findSession( id ); if ( result != null ) { final byte[] data = _sessionData.remove( id ); if ( data != null ) { _executorService.submit( new SessionDeserialization( id, data ) ); } } return result; }
@Test public void testInvalidNonStickySessionDoesNotCallOnBackupWithoutLoadedSessionIssue137() throws Exception { _service.setStickyInternal( false ); _service.setLockingMode( LockingMode.NONE, null, false ); _service.startInternal(new MemcachedStorageClient(_memcachedMock)); // we must put in our mock again final String sessionId = "nonStickySessionToTimeOut-n1"; // For findSession needed final Request requestMock = mock(Request.class); when(requestMock.getNote(eq(RequestTrackingContextValve.INVOKED))).thenReturn(Boolean.TRUE); _service.getTrackingHostValve().storeRequestThreadLocal(requestMock); final MemcachedBackupSession session = _service.findSession(sessionId); assertNull(session); _service.backupSession( sessionId, false, null ).get(); // check that validity info is not loaded - this would trigger the // WARNING: Found no validity info for session id ... final String validityKey = new SessionIdFormat().createValidityInfoKeyName( sessionId ); verify( _memcachedMock, times( 0 ) ).get( eq( validityKey ) ); }
@Override public BackupResult call() throws Exception { final MemcachedBackupSession session3 = _service.findSession(session.getId()); assertSame(session3, session2); assertEquals(session3.getRefCount(), 2); // let the other thread proceed (or wait) barrier.await(); // and wait again so that the other thread can do some work barrier.await(); final Future<BackupResult> result = _service.backupSession(session.getId(), false, "unused"); _service.getTrackingHostValve().resetRequestThreadLocal(); assertEquals(result.get().getStatus(), BackupResultStatus.SUCCESS); // The session should be released now and no longer stored assertFalse(_service.getManager().getSessionsInternal().containsKey(session.getId())); // just some double checking on expectations... assertEquals(session2.getRefCount(), 0); return result.get(); }
/** * Return the active Session, associated with this Manager, with the * specified session id (if any); otherwise return <code>null</code>. * * @param id * The session id for the session to be returned * @return the session or <code>null</code> if no session was found locally * or in memcached. * * @exception IllegalStateException * if a new session cannot be instantiated for any reason * @exception IOException * if an input/output error occurs while processing this * request */ @Override public Session findSession( final String id ) throws IOException { return _msm.findSession( id ); }
final MemcachedBackupSession session2 = _service.findSession(session.getId()); assertTrue(session2.isLocked()); assertEquals(session2.getRefCount(), 1);
@Override public MemcachedBackupSession findSession( final String id ) throws IOException { final MemcachedBackupSession result = super.findSession( id ); if ( result != null ) { final byte[] data = _sessionData.remove( id ); if ( data != null ) { _executorService.submit( new SessionDeserialization( id, data ) ); } } return result; }