void destroy(boolean invalidate) { valid = false; webFilter.getClusteredSessionService().deleteSession(id, invalidate); }
void destroy(boolean invalidate) { valid = false; webFilter.getClusteredSessionService().deleteSession(id, invalidate); }
private Set<String> selectKeys() { Set<String> keys = new HashSet<String>(); if (!deferredWrite) { Set<String> attributeNames = null; try { attributeNames = webFilter.getClusteredSessionService().getAttributeNames(id); } catch (Exception ignored) { for (Map.Entry<String, LocalCacheEntry> entry : localCache.entrySet()) { if (!entry.getValue().isRemoved() && entry.getValue().getValue() != null) { keys.add(entry.getKey()); } } } if (attributeNames != null) { keys.addAll(attributeNames); } } else { for (Map.Entry<String, LocalCacheEntry> entry : localCache.entrySet()) { if (!entry.getValue().isRemoved() && entry.getValue().getValue() != null) { keys.add(entry.getKey()); } } } return keys; }
private Set<String> selectKeys() { Set<String> keys = new HashSet<String>(); if (!deferredWrite) { Set<String> attributeNames = null; try { attributeNames = webFilter.getClusteredSessionService().getAttributeNames(id); } catch (Exception ignored) { for (Map.Entry<String, LocalCacheEntry> entry : localCache.entrySet()) { if (!entry.getValue().isRemoved() && entry.getValue().getValue() != null) { keys.add(entry.getKey()); } } } if (attributeNames != null) { keys.addAll(attributeNames); } } else { for (Map.Entry<String, LocalCacheEntry> entry : localCache.entrySet()) { if (!entry.getValue().isRemoved() && entry.getValue().getValue() != null) { keys.add(entry.getKey()); } } } return keys; }
void sessionDeferredWrite() { if (sessionChanged() || isNew()) { Map<String, Object> updates = new HashMap<String, Object>(); Iterator<Map.Entry<String, LocalCacheEntry>> iterator = localCache.entrySet().iterator(); while (iterator.hasNext()) { Map.Entry<String, LocalCacheEntry> entry = iterator.next(); LocalCacheEntry cacheEntry = entry.getValue(); if (cacheEntry.isDirty() && !cacheEntry.isTransient()) { if (cacheEntry.isRemoved()) { updates.put(entry.getKey(), null); } else { updates.put(entry.getKey(), cacheEntry.getValue()); } cacheEntry.setDirty(false); } } try { webFilter.getClusteredSessionService().updateAttributes(id, updates); } catch (Exception ignored) { EmptyStatement.ignore(ignored); } } }
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); } } }
void sessionDeferredWrite() { if (sessionChanged() || isNew()) { Map<String, Object> updates = new HashMap<String, Object>(); Iterator<Map.Entry<String, LocalCacheEntry>> iterator = localCache.entrySet().iterator(); while (iterator.hasNext()) { Map.Entry<String, LocalCacheEntry> entry = iterator.next(); LocalCacheEntry cacheEntry = entry.getValue(); if (cacheEntry.isDirty() && !cacheEntry.isTransient()) { if (cacheEntry.isRemoved()) { updates.put(entry.getKey(), null); } else { updates.put(entry.getKey(), cacheEntry.getValue()); } cacheEntry.setDirty(false); } } try { webFilter.getClusteredSessionService().updateAttributes(id, updates); } catch (HazelcastSerializationException e) { LOGGER.warning("Failed to serialize session with ID [" + id + "]:" + e.getMessage(), e); } catch (Exception e) { LOGGER.warning("Unexpected error occurred.", e); } } }
public void removeAttribute(final String name) { LocalCacheEntry entry = localCache.get(name); if (entry != null && entry != WebFilter.NULL_ENTRY) { entry.setValue(null); entry.setRemoved(true); entry.setDirty(true); entry.setReload(false); } if (!deferredWrite) { try { webFilter.getClusteredSessionService().deleteAttribute(id, name); entry.setDirty(false); } catch (Exception ignored) { EmptyStatement.ignore(ignored); } } }
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(); }
public void removeAttribute(final String name) { LocalCacheEntry entry = localCache.get(name); if (entry != null && entry != WebFilter.NULL_ENTRY) { entry.setValue(null); entry.setRemoved(true); entry.setDirty(true); entry.setReload(false); } if (!deferredWrite) { try { webFilter.getClusteredSessionService().deleteAttribute(id, name); if (entry != null) { entry.setDirty(false); } } catch (Exception e) { LOGGER.warning("Unexpected error occurred.", e); } } }
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(); }
if (!deferredWrite && !transientEntry) { try { webFilter.getClusteredSessionService().setAttribute(id, name, value); entry.setDirty(false); } catch (HazelcastSerializationException e) {
if (!deferredWrite && !transientEntry) { try { webFilter.getClusteredSessionService().setAttribute(id, name, value); entry.setDirty(false); } catch (HazelcastSerializationException e) {