private void waitForSessionExpiration(final boolean sticky) throws InterruptedException { final SessionManager manager = _tomcat1.getManager(); assertEquals( manager.getMemcachedSessionService().isSticky(), sticky ); final Container container = manager.getContext(); final long timeout = TimeUnit.SECONDS.toMillis( sticky ? container.getBackgroundProcessorDelay() + manager.getMaxInactiveInterval() : 2 * manager.getMaxInactiveInterval() ) + 1000; Thread.sleep( timeout ); }
Thread.sleep( TimeUnit.SECONDS.toMillis( manager.getMaxInactiveInterval() ) - 500 ); assertNotNull( _memcached.get( sessionId1 ), "Session should still exist in memcached." );
session.setCreationTime( System.currentTimeMillis() ); session.setMaxInactiveInterval( _manager.isMaxInactiveIntervalSet() ? _manager.getMaxInactiveInterval() : _manager.getContext().getSessionTimeout() * 60 );
session.setCreationTime( System.currentTimeMillis() ); session.setMaxInactiveInterval( _manager.isMaxInactiveIntervalSet() ? _manager.getMaxInactiveInterval() : _manager.getContext().getSessionTimeout() * 60 );