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);
}
}
}