Redisson putting an ArrayList or RList inside an RMap. What will happen?

1k views Asked by At

Example in code:

map = client.getMap(...)

list = client.getList();

map.put(.., list);

...

list.add(....);

... 

thelist = map.get(...,)

What will happen here?

Will the list be converted to json, or will Redisson figure it out and use only the reference list?

Will updates to the list get reflected in the map?

What will happen if I decide to wrap the RedissonList, will my wrapper class be serialized to json, while the delegate list be a reference to the redis list, or will it also be serialized.

Many questions but important to get the hang of what is possible and what is not.

map.compute also does not seem to be locking other than locally so one has to be careful.

I suggethe implementation should override everything in java.util in their subclasses and comment or annotate (informative annotation only) to say that this method only has lcal java.util.Map works local effects.

1

There are 1 answers

2
Nikita Koksharov On

In this case RMap value holds a reference to RList object.

map.compute also does not seem to be locking other than locally so one has to be careful.

As stated in comment it doesn't have locking even for local map: The default implementation makes no guarantees about synchronization or atomicity properties of this method