private void buildLocalCache() { Set<Map.Entry<String, Object>> entrySet = null; try { entrySet = webFilter.getClusteredSessionService().getAttributes(id); } catch (Exception e) { return; } if (entrySet != null) { for (Map.Entry<String, Object> entry : entrySet) { String attributeKey = entry.getKey(); LocalCacheEntry cacheEntry = localCache.get(attributeKey); if (cacheEntry == null) { cacheEntry = new LocalCacheEntry(transientAttributes.contains(attributeKey)); localCache.put(attributeKey, cacheEntry); } if (WebFilter.LOGGER.isFinestEnabled()) { WebFilter.LOGGER.finest("Storing " + attributeKey + " on session " + id); } cacheEntry.setValue(entry.getValue()); cacheEntry.setDirty(false); } } }
private void buildLocalCache() { Set<Map.Entry<String, Object>> entrySet = null; try { entrySet = webFilter.getClusteredSessionService().getAttributes(id); } catch (Exception e) { return; } if (entrySet != null) { for (Map.Entry<String, Object> entry : entrySet) { String attributeKey = entry.getKey(); LocalCacheEntry cacheEntry = localCache.get(attributeKey); if (cacheEntry == null) { cacheEntry = new LocalCacheEntry(transientAttributes.contains(attributeKey)); localCache.put(attributeKey, cacheEntry); } if (LOGGER.isFinestEnabled()) { LOGGER.finest("Storing " + attributeKey + " on session " + id); } cacheEntry.setValue(entry.getValue()); cacheEntry.setDirty(false); } } }
public Object getAttribute(final String name) { LocalCacheEntry cacheEntry = localCache.get(name); Object value = null; if (cacheEntry == null || cacheEntry.isReload()) { try { value = webFilter.getClusteredSessionService().getAttribute(id, name); cacheEntry = new LocalCacheEntry(false, value); cacheEntry.setReload(false); localCache.put(name, cacheEntry); } catch (Exception e) { if (LOGGER.isFinestEnabled()) { LOGGER.finest("session could not be load so you might be dealing with stale data", e); } if (cacheEntry == null) { return null; } } } if (cacheEntry.isRemoved()) { return null; } return cacheEntry.getValue(); }
public Object getAttribute(final String name) { LocalCacheEntry cacheEntry = localCache.get(name); Object value = null; if (cacheEntry == null || cacheEntry.isReload()) { try { value = webFilter.getClusteredSessionService().getAttribute(id, name); cacheEntry = new LocalCacheEntry(false, value); cacheEntry.setReload(false); localCache.put(name, cacheEntry); } catch (Exception e) { if (WebFilter.LOGGER.isFinestEnabled()) { WebFilter.LOGGER.finest("session could not be load so you might be dealing with stale data", e); } if (cacheEntry == null) { return null; } } } if (cacheEntry.isRemoved()) { return null; } return cacheEntry.getValue(); }
entry = new LocalCacheEntry(transientEntry); localCache.put(name, entry);
entry = new LocalCacheEntry(transientEntry); localCache.put(name, entry);