public Ehcache inMemoryCache(String uuid) { // Check to make sure exists getDataNullOrThrowOnTimeout(uuid, true); String key = "memory:" + uuid; return createCache(key, true, 0); }
/** * Retrieve a session possibly raising either * {@link RemovedSessionException} or {@link SessionTimeoutException}. */ public SessionContext getSessionContext(String uuid) { return getSessionContext(uuid, false); }
public Object call() throws Exception { cache.reload(uuid); return null; }});
/** * Used externally to refresh the {@link SessionContext} instance * associated with the session uuid * @param uuid * @param replacement */ public void refresh(String uuid, SessionContext replacement) { Data data = getDataNullOrThrowOnTimeout(uuid, true); refresh(uuid, data, replacement); }
/** * Puts a session blindly into the context. This does nothing to a context * which was previously present (e.g. call internalRemove, etc.) and * therefore usage should be proceeded by a check. */ public void putSession(String uuid, SessionContext sessionContext) { Data data = new Data(sessionContext); this.sessions.put(uuid, data); final StopWatch sw = new Slf4JStopWatch("omero.session"); addSessionCallback(uuid, new SessionCallback.SimpleCloseCallback(){ public void close() { sw.stop(); }}); }
/** * Retrieve a session possibly raising either * {@link RemovedSessionException} or {@link SessionTimeoutException}. * * @param quietly If true, then the access time for the given UUID * will not be updated. */ public SessionContext getSessionContext(String uuid, boolean quietly) { if (uuid == null) { throw new ApiUsageException("Uuid cannot be null."); } Data data = getDataNullOrThrowOnTimeout(uuid, true); if (!quietly) { // Up'ing access time this.sessions.put(uuid, new Data(data)); } return data.sessionContext; }
public void notifyElementEvicted(Ehcache arg0, Element arg1) { if (log.isDebugEnabled()) { log.debug("Evicting element: " + idString(arg1)); } }
public Ehcache inMemoryCache(String uuid) { return cache.inMemoryCache(uuid); }
public void removeSession(String uuid) { internalRemove(uuid, "Remove session called"); }
public void setSessionCache(SessionCache sessionCache) { cache = sessionCache; this.cache.setStaleCacheListener(this); }
public Ehcache onDiskCache(String uuid) { return cache.onDiskCache(uuid); }
/** * * @param uuid * @param data * @param replacement */ private void refresh(String uuid, Data data, SessionContext replacement) { // Adding and upping hit information. Data fresh = new Data(data, replacement, false); this.sessions.put(uuid, fresh); }
@Override public Ehcache getObject() { Ehcache cache = (Ehcache) super.getObject(); registerAll(cache, cacheListeners); return cache; }
/** */ public void onApplicationEvent(ApplicationEvent event) { if (event instanceof UserGroupUpdateEvent) { cache.updateEvent((UserGroupUpdateEvent) event); } else if (event instanceof DestroySessionMessage) { sessionProvider.executeCloseSession(((DestroySessionMessage) event).getSessionId()); } }
public Ehcache onDiskCache(String uuid) { // Check to make sure exists getDataNullOrThrowOnTimeout(uuid, true); String key = "ondisk:" + uuid; return createCache(key, false, 100); }
public void notifyElementPut(Ehcache arg0, Element arg1) throws CacheException { if (log.isDebugEnabled()) { log.debug("Putting element: " + idString(arg1)); } }
public SessionStats getSessionStats(String uuid) { SessionContext ctx = cache.getSessionContext(uuid); return ctx.stats(); }
public void notifyElementRemoved(Ehcache arg0, Element arg1) throws CacheException { if (log.isDebugEnabled()) { log.debug("Removing element: " + idString(arg1)); } }
public void notifyElementExpired(Ehcache arg0, Element arg1) { if (log.isDebugEnabled()) { log.debug("Expiring servant: " + idString(arg1)); } }
public void notifyElementUpdated(Ehcache arg0, Element arg1) throws CacheException { if (log.isDebugEnabled()) { log.debug("Updating element: " + idString(arg1)); } }