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 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); } } }
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); } } }
entry.setDirty(true); entry.setRemoved(false); entry.setReload(false); try { webFilter.getClusteredSessionService().setAttribute(id, name, value); entry.setDirty(false); } catch (HazelcastSerializationException e) { LOGGER.warning("Failed to serialize attribute [" + name + "]:" + e.getMessage(), e);
entry.setDirty(true); entry.setRemoved(false); entry.setReload(false); try { webFilter.getClusteredSessionService().setAttribute(id, name, value); entry.setDirty(false); } catch (HazelcastSerializationException e) { WebFilter.LOGGER.warning("Failed to serialize attribute [" + name + "]:" + e.getMessage(), e);