Fixed - RObject.addListenerAsync() method throws UnsupportedOperationException #5673

pull/5679/head
Nikita Koksharov 11 months ago
parent a2e833770f
commit 76b2555eb5

@ -513,7 +513,7 @@ public abstract class RedissonObject implements RObject {
} }
protected final RFuture<Void> removeListenerAsync(int listenerId, String... names) { protected final RFuture<Void> removeListenerAsync(int listenerId, String... names) {
List<String> ns = Arrays.asList(names); List<String> ns = new ArrayList<>(Arrays.asList(names));
ns.addAll(Arrays.asList("__keyevent@*:expired", "__keyevent@*:del")); ns.addAll(Arrays.asList("__keyevent@*:expired", "__keyevent@*:del"));
return removeListenerAsync(null, listenerId, ns.toArray(new String[0])); return removeListenerAsync(null, listenerId, ns.toArray(new String[0]));
} }

@ -298,6 +298,19 @@ public class RedissonBucketTest extends RedisDockerTest {
}, NOTIFY_KEYSPACE_EVENTS, "Eg"); }, NOTIFY_KEYSPACE_EVENTS, "Eg");
} }
@Test
public void testRemoveListenerAsync() {
testWithParams(redisson -> {
RBucket<Integer> al = redisson.getBucket("test");
int id = al.addListenerAsync(new SetObjectListener() {
@Override
public void onSet(String name) {
}
}).toCompletableFuture().join();
al.removeListenerAsync(id).toCompletableFuture().join();
}, NOTIFY_KEYSPACE_EVENTS, "E$");
}
@Test @Test
public void testSetListener() { public void testSetListener() {
testWithParams(redisson -> { testWithParams(redisson -> {

Loading…
Cancel
Save