DefaultSessionCacheFactory cacheFactory = new DefaultSessionCacheFactory(); cacheFactory.setEvictionPolicy(SessionCache.NEVER_EVICT); SessionDataStoreFactory storeFactory = createSessionDataStoreFactory(); ((AbstractSessionDataStoreFactory)storeFactory).setGracePeriodSec(TestServer.DEFAULT_SCAVENGE_SEC);
/** * @see org.eclipse.jetty.server.session.SessionCacheFactory#getSessionCache(org.eclipse.jetty.server.session.SessionHandler) */ @Override public SessionCache getSessionCache (SessionHandler handler) { DefaultSessionCache cache = new DefaultSessionCache(handler); cache.setEvictionPolicy(getEvictionPolicy()); cache.setSaveOnInactiveEviction(isSaveOnInactiveEvict()); cache.setSaveOnCreate(isSaveOnCreate()); cache.setRemoveUnloadableSessions(isRemoveUnloadableSessions()); return cache; }
int scavengePeriod = 10; DefaultSessionCacheFactory cacheFactory = new DefaultSessionCacheFactory(); cacheFactory.setEvictionPolicy(SessionCache.NEVER_EVICT); SessionDataStoreFactory storeFactory = createSessionDataStoreFactory(); ((AbstractSessionDataStoreFactory)storeFactory).setGracePeriodSec(scavengePeriod);
String servletMapping = "/server"; int inactivePeriod = 5; DefaultSessionCacheFactory cacheFactory = new DefaultSessionCacheFactory(); cacheFactory.setEvictionPolicy(SessionCache.NEVER_EVICT); SessionDataStoreFactory storeFactory = createSessionDataStoreFactory(); if (storeFactory instanceof AbstractSessionDataStoreFactory) int scavengePeriod = 2; DefaultSessionCacheFactory evictCacheFactory = new DefaultSessionCacheFactory();
int scavengePeriod = 3; DefaultSessionCacheFactory cacheFactory = new DefaultSessionCacheFactory(); cacheFactory.setEvictionPolicy(SessionCache.NEVER_EVICT); SessionDataStoreFactory storeFactory = createSessionDataStoreFactory(); ((AbstractSessionDataStoreFactory)storeFactory).setGracePeriodSec(scavengePeriod);
int sleep = oldMaxInactive+(int)(oldMaxInactive * 0.8); DefaultSessionCacheFactory cacheFactory = new DefaultSessionCacheFactory(); cacheFactory.setEvictionPolicy(SessionCache.NEVER_EVICT); SessionDataStoreFactory storeFactory = createSessionDataStoreFactory(); ((AbstractSessionDataStoreFactory)storeFactory).setGracePeriodSec(TestServer.DEFAULT_SCAVENGE_SEC);
int scavengePeriod = 1; DefaultSessionCacheFactory cacheFactory = new DefaultSessionCacheFactory(); cacheFactory.setEvictionPolicy(SessionCache.NEVER_EVICT); SessionDataStoreFactory storeFactory = createSessionDataStoreFactory(); ((AbstractSessionDataStoreFactory)storeFactory).setGracePeriodSec(scavengePeriod);
DefaultSessionCacheFactory cacheFactory = new DefaultSessionCacheFactory(); cacheFactory.setEvictionPolicy(SessionCache.NEVER_EVICT); SessionDataStoreFactory storeFactory = createSessionDataStoreFactory(); ((AbstractSessionDataStoreFactory)storeFactory).setGracePeriodSec(TestServer.DEFAULT_SCAVENGE_SEC);
String servletMapping = "/server"; DefaultSessionCacheFactory cacheFactory = new DefaultSessionCacheFactory(); cacheFactory.setEvictionPolicy(SessionCache.NEVER_EVICT); SessionDataStoreFactory storeFactory = createSessionDataStoreFactory(); ((AbstractSessionDataStoreFactory)storeFactory).setGracePeriodSec(TestServer.DEFAULT_SCAVENGE_SEC);
int scavengePeriod = 10; DefaultSessionCacheFactory cacheFactory = new DefaultSessionCacheFactory(); cacheFactory.setEvictionPolicy(SessionCache.NEVER_EVICT); SessionDataStoreFactory storeFactory = createSessionDataStoreFactory(); ((AbstractSessionDataStoreFactory)storeFactory).setGracePeriodSec(scavengePeriod);
int newMaxInactive = 120; DefaultSessionCacheFactory cacheFactory = new DefaultSessionCacheFactory(); cacheFactory.setEvictionPolicy(SessionCache.NEVER_EVICT); SessionDataStoreFactory storeFactory = createSessionDataStoreFactory(); ((AbstractSessionDataStoreFactory)storeFactory).setGracePeriodSec(TestServer.DEFAULT_SCAVENGE_SEC);
int sleep = (int)(oldMaxInactive * 0.8); DefaultSessionCacheFactory cacheFactory = new DefaultSessionCacheFactory(); cacheFactory.setEvictionPolicy(SessionCache.NEVER_EVICT); SessionDataStoreFactory storeFactory = createSessionDataStoreFactory(); ((AbstractSessionDataStoreFactory)storeFactory).setGracePeriodSec(TestServer.DEFAULT_SCAVENGE_SEC);
int sleep = evict; DefaultSessionCacheFactory cacheFactory = new DefaultSessionCacheFactory(); cacheFactory.setEvictionPolicy(evict); SessionDataStoreFactory storeFactory = createSessionDataStoreFactory(); ((AbstractSessionDataStoreFactory)storeFactory).setGracePeriodSec(TestServer.DEFAULT_SCAVENGE_SEC);
int sleep = evict; DefaultSessionCacheFactory cacheFactory = new DefaultSessionCacheFactory(); cacheFactory.setEvictionPolicy(evict); SessionDataStoreFactory storeFactory = createSessionDataStoreFactory(); ((AbstractSessionDataStoreFactory)storeFactory).setGracePeriodSec(TestServer.DEFAULT_SCAVENGE_SEC);
int sleep = (int)(oldMaxInactive * 0.8); DefaultSessionCacheFactory cacheFactory = new DefaultSessionCacheFactory(); cacheFactory.setEvictionPolicy(SessionCache.NEVER_EVICT); SessionDataStoreFactory storeFactory = createSessionDataStoreFactory(); ((AbstractSessionDataStoreFactory)storeFactory).setGracePeriodSec(TestServer.DEFAULT_SCAVENGE_SEC);
int maxInactivePeriod = 1; DefaultSessionCacheFactory cacheFactory = new DefaultSessionCacheFactory(); cacheFactory.setEvictionPolicy(SessionCache.NEVER_EVICT); SessionDataStoreFactory storeFactory = createSessionDataStoreFactory(); ((AbstractSessionDataStoreFactory)storeFactory).setGracePeriodSec(scavengePeriod);
int maxInactivePeriod = 0; DefaultSessionCacheFactory cacheFactory = new DefaultSessionCacheFactory(); cacheFactory.setEvictionPolicy(SessionCache.NEVER_EVICT); SessionDataStoreFactory storeFactory = createSessionDataStoreFactory(); ((AbstractSessionDataStoreFactory)storeFactory).setGracePeriodSec(scavengePeriod);
int scavengePeriod = 0; DefaultSessionCacheFactory cacheFactory = new DefaultSessionCacheFactory(); cacheFactory.setEvictionPolicy(SessionCache.NEVER_EVICT); SessionDataStoreFactory storeFactory = createSessionDataStoreFactory();
int scavengePeriod = 1; DefaultSessionCacheFactory cacheFactory = new DefaultSessionCacheFactory(); cacheFactory.setEvictionPolicy(SessionCache.NEVER_EVICT); SessionDataStoreFactory storeFactory = createSessionDataStoreFactory(); ((AbstractSessionDataStoreFactory)storeFactory).setGracePeriodSec(scavengePeriod);
int scavengePeriod = 2; //scavenging occurs every 2 seconds DefaultSessionCacheFactory cacheFactory = new DefaultSessionCacheFactory(); cacheFactory.setEvictionPolicy(SessionCache.NEVER_EVICT); SessionDataStoreFactory storeFactory = createSessionDataStoreFactory(); ((AbstractSessionDataStoreFactory)storeFactory).setGracePeriodSec(scavengePeriod);