Skip to content

Commit 369552d

Browse files
committed
Make removeMessageListener listener parameter non-nullable
Signed-off-by: Kiminni <imk0980@gmail.com>
1 parent 88d8f84 commit 369552d

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/main/java/org/springframework/data/redis/listener/RedisMessageListenerContainer.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@
104104
* @author John Blum
105105
* @author Seongjun Lee
106106
* @author Su Ko
107+
* @author Mingi Lee
107108
* @see MessageListener
108109
* @see SubscriptionListener
109110
*/
@@ -591,7 +592,7 @@ public void addMessageListener(MessageListener listener, Topic topic) {
591592
* @param listener message listener.
592593
* @param topics message listener topics.
593594
*/
594-
public void removeMessageListener(@Nullable MessageListener listener, Collection<? extends Topic> topics) {
595+
public void removeMessageListener(MessageListener listener, Collection<? extends Topic> topics) {
595596
removeListener(listener, topics);
596597
}
597598

@@ -605,7 +606,7 @@ public void removeMessageListener(@Nullable MessageListener listener, Collection
605606
* @param listener message listener.
606607
* @param topic message topic.
607608
*/
608-
public void removeMessageListener(@Nullable MessageListener listener, Topic topic) {
609+
public void removeMessageListener(MessageListener listener, Topic topic) {
609610
removeMessageListener(listener, Collections.singleton(topic));
610611
}
611612

@@ -744,11 +745,12 @@ private Collection<MessageListener> resolveMessageListeners(
744745
return mapping.computeIfAbsent(topic, k -> new CopyOnWriteArraySet<>());
745746
}
746747

747-
private void removeListener(@Nullable MessageListener listener, Collection<? extends Topic> topics) {
748+
private void removeListener(MessageListener listener, Collection<? extends Topic> topics) {
748749

750+
Assert.notNull(listener, "MessageListener must not be null");
749751
Assert.notNull(topics, "Topics must not be null");
750752

751-
if (listener != null && listenerTopics.get(listener) == null) {
753+
if (listenerTopics.get(listener) == null) {
752754
// Listener not subscribed
753755
return;
754756
}

0 commit comments

Comments
 (0)