Incidently, I think the following code is wrong in the infinispan implementation of DistributedCacheManager
| @Override |
| public void storeSessionData(final T sessionData) { |
| | final K key = this.keyFactory.createKey(sessionData.getRealId()); |
| | trace("storeSessionData(%s)", key.getSessionId()); |
| | Operation<Void> operation = new Operation<Void>() { |
| | @Override |
| | public Void invoke(Cache<K, Map<Object, Object>> cache) { |
| | Map<Object, Object> map = cache.putIfAbsent(key, null); |
| | SessionMapEntry.VERSION.put(map, Integer.valueOf(sessionData.getVersion())); |
| | SessionMapEntry.METADATA.put(map, sessionData.getMetadata()); |
| | SessionMapEntry.TIMESTAMP.put(map, sessionData.getTimestamp()); |
| | try { |
| | DistributedCacheManager.this.attributeStorage.store(map, sessionData); |
| | } catch (IOException e) { |
| | throw getRuntimeException("Failed to store session attributes for session: " + mask(key.getSessionId()), e); |
| | } |
| | return null; |
| | } |
| | }; |
In that it will overwrite thinks like the metadata with null if it hasn't changed.
see isSessionMetaDataDirty() referenced in the code above.