JBoss Community

Re: DistributedCache replication

created by Adrian Brock in JBoss AS7 Development - View the full discussion

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

 

    this.batch(operation);
}

 

In that it will overwrite thinks like the metadata with null if it hasn't changed.

see isSessionMetaDataDirty() referenced in the code above.

Reply to this message by going to Community

Start a new discussion in JBoss AS7 Development at Community