From c60b275de71fdda880c045ad95c4b0d245d51f75 Mon Sep 17 00:00:00 2001 From: Nikita Koksharov Date: Thu, 3 Nov 2022 09:39:48 +0300 Subject: [PATCH] Fixed - RMapCache MapEntryListener doesn't work with nameMapper #4591 --- .../src/main/java/org/redisson/RedissonMap.java | 4 ++-- .../main/java/org/redisson/RedissonMapCache.java | 16 ++++++++-------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/redisson/src/main/java/org/redisson/RedissonMap.java b/redisson/src/main/java/org/redisson/RedissonMap.java index 2e2ac39ed..9e19d44af 100644 --- a/redisson/src/main/java/org/redisson/RedissonMap.java +++ b/redisson/src/main/java/org/redisson/RedissonMap.java @@ -76,7 +76,7 @@ public class RedissonMap extends RedissonExpirable implements RMap { && options.getWriteMode() == WriteMode.WRITE_BEHIND && (options.getWriter() != null || options.getWriterAsync() != null)) { this.writeBehindService = writeBehindService; - writeBehindTask = writeBehindService.start(name, options); + writeBehindTask = writeBehindService.start(getRawName(), options); } else { this.writeBehindService = null; writeBehindTask = null; @@ -100,7 +100,7 @@ public class RedissonMap extends RedissonExpirable implements RMap { && options.getWriteMode() == WriteMode.WRITE_BEHIND && (options.getWriter() != null || options.getWriterAsync() != null)) { this.writeBehindService = writeBehindService; - writeBehindTask = writeBehindService.start(name, options); + writeBehindTask = writeBehindService.start(getRawName(), options); } else { this.writeBehindService = null; writeBehindTask = null; diff --git a/redisson/src/main/java/org/redisson/RedissonMapCache.java b/redisson/src/main/java/org/redisson/RedissonMapCache.java index a33836fb5..a0c96fe46 100644 --- a/redisson/src/main/java/org/redisson/RedissonMapCache.java +++ b/redisson/src/main/java/org/redisson/RedissonMapCache.java @@ -2284,7 +2284,7 @@ public class RedissonMapCache extends RedissonMap implements RMapCac } if (listener instanceof EntryRemovedListener) { - RTopic topic = redisson.getTopic(getRemovedChannelName(), new MapCacheEventCodec(codec, osType)); + RTopic topic = RedissonTopic.createRaw(new MapCacheEventCodec(codec, osType), commandExecutor, getRemovedChannelName()); return topic.addListener(List.class, new MessageListener>() { @Override public void onMessage(CharSequence channel, List msg) { @@ -2295,7 +2295,7 @@ public class RedissonMapCache extends RedissonMap implements RMapCac } if (listener instanceof EntryCreatedListener) { - RTopic topic = redisson.getTopic(getCreatedChannelName(), new MapCacheEventCodec(codec, osType)); + RTopic topic = RedissonTopic.createRaw(new MapCacheEventCodec(codec, osType), commandExecutor, getCreatedChannelName()); return topic.addListener(List.class, new MessageListener>() { @Override public void onMessage(CharSequence channel, List msg) { @@ -2306,7 +2306,7 @@ public class RedissonMapCache extends RedissonMap implements RMapCac } if (listener instanceof EntryUpdatedListener) { - RTopic topic = redisson.getTopic(getUpdatedChannelName(), new MapCacheEventCodec(codec, osType)); + RTopic topic = RedissonTopic.createRaw(new MapCacheEventCodec(codec, osType), commandExecutor, getUpdatedChannelName()); return topic.addListener(List.class, new MessageListener>() { @Override public void onMessage(CharSequence channel, List msg) { @@ -2317,7 +2317,7 @@ public class RedissonMapCache extends RedissonMap implements RMapCac } if (listener instanceof EntryExpiredListener) { - RTopic topic = redisson.getTopic(getExpiredChannelName(), new MapCacheEventCodec(codec, osType)); + RTopic topic = RedissonTopic.createRaw(new MapCacheEventCodec(codec, osType), commandExecutor, getExpiredChannelName()); return topic.addListener(List.class, new MessageListener>() { @Override public void onMessage(CharSequence channel, List msg) { @@ -2334,16 +2334,16 @@ public class RedissonMapCache extends RedissonMap implements RMapCac public void removeListener(int listenerId) { super.removeListener(listenerId); - RTopic removedTopic = redisson.getTopic(getRemovedChannelName()); + RTopic removedTopic = RedissonTopic.createRaw(new MapCacheEventCodec(codec, osType), commandExecutor, getRemovedChannelName()); removedTopic.removeListener(listenerId); - RTopic createdTopic = redisson.getTopic(getCreatedChannelName()); + RTopic createdTopic = RedissonTopic.createRaw(new MapCacheEventCodec(codec, osType), commandExecutor, getCreatedChannelName()); createdTopic.removeListener(listenerId); - RTopic updatedTopic = redisson.getTopic(getUpdatedChannelName()); + RTopic updatedTopic = RedissonTopic.createRaw(new MapCacheEventCodec(codec, osType), commandExecutor, getUpdatedChannelName()); updatedTopic.removeListener(listenerId); - RTopic expiredTopic = redisson.getTopic(getExpiredChannelName()); + RTopic expiredTopic = RedissonTopic.createRaw(new MapCacheEventCodec(codec, osType), commandExecutor, getExpiredChannelName()); expiredTopic.removeListener(listenerId); }