Polishing contribution

Closes gh-34333
This commit is contained in:
rstoyanchev 2025-02-10 10:09:21 +00:00
parent c41b0140cd
commit ccdaed594e
3 changed files with 12 additions and 10 deletions

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2024 the original author or authors. * Copyright 2002-2025 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -280,11 +280,10 @@ public class UserDestinationMessageHandler implements MessageHandler, SmartLifec
return this.messagingTemplate; return this.messagingTemplate;
} }
public void send(UserDestinationResult destinationResult, Message<?> message) throws MessagingException { public void send(UserDestinationResult result, Message<?> message) throws MessagingException {
Iterator<String> itr = destinationResult.getSessionIds().iterator(); Iterator<String> itr = result.getSessionIds().iterator();
for (String target : result.getTargetDestinations()) {
for (String target : destinationResult.getTargetDestinations()) { String sessionId = (itr.hasNext() ? itr.next() : null);
String sessionId = (itr != null && itr.hasNext() ? itr.next() : null);
getTemplateToUse(sessionId).send(target, message); getTemplateToUse(sessionId).send(target, message);
} }
} }

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2023 the original author or authors. * Copyright 2002-2025 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -44,7 +44,11 @@ public class UserDestinationResult {
private final Set<String> sessionIds; private final Set<String> sessionIds;
public UserDestinationResult(String sourceDestination, Set<String> targetDestinations, /**
* Main constructor.
*/
public UserDestinationResult(
String sourceDestination, Set<String> targetDestinations,
String subscribeDestination, @Nullable String user) { String subscribeDestination, @Nullable String user) {
this(sourceDestination, targetDestinations, subscribeDestination, user, null); this(sourceDestination, targetDestinations, subscribeDestination, user, null);
@ -114,7 +118,6 @@ public class UserDestinationResult {
/** /**
* Return the session id for the targetDestination. * Return the session id for the targetDestination.
*/ */
@Nullable
public Set<String> getSessionIds() { public Set<String> getSessionIds() {
return this.sessionIds; return this.sessionIds;
} }

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2024 the original author or authors. * Copyright 2002-2025 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.