Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.jspecify.annotations.Nullable;

import org.springframework.integration.support.utils.IntegrationUtils;
import org.springframework.messaging.Message;
Expand Down Expand Up @@ -53,7 +54,7 @@ public abstract class AbstractDispatcher implements MessageDispatcher {

private volatile int maxSubscribers = Integer.MAX_VALUE;

private volatile MessageHandler theOneHandler;
private volatile @Nullable MessageHandler theOneHandler;

private final Lock lock = new ReentrantLock();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
import java.util.ArrayList;
import java.util.List;

import org.jspecify.annotations.Nullable;

import org.springframework.messaging.Message;
import org.springframework.messaging.MessageDeliveryException;
import org.springframework.util.StringUtils;
Expand All @@ -30,6 +32,7 @@
* @author Mark Fisher
* @author Artem Bilan
* @author Gary Russell
* @author Glenn Renfro
*
* @since 1.0.3
*/
Expand Down Expand Up @@ -69,7 +72,7 @@ public String getMessage() {
return message.toString();
}

private String appendPeriodIfNecessary(String baseMessage) {
private String appendPeriodIfNecessary(@Nullable String baseMessage) {
if (!StringUtils.hasText(baseMessage)) {
return "";
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
import java.util.UUID;
import java.util.concurrent.Executor;

import org.jspecify.annotations.Nullable;

import org.springframework.beans.BeansException;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.beans.factory.BeanFactoryAware;
Expand Down Expand Up @@ -56,12 +58,13 @@
* @author Gary Russell
* @author Oleg Zhurakousky
* @author Artem Bilan
* @author Glenn Renfro
*/
public class BroadcastingDispatcher extends AbstractDispatcher implements BeanFactoryAware {

private final boolean requireSubscribers;

private final Executor executor;
private final @Nullable Executor executor;

private boolean ignoreFailures;

Expand All @@ -71,6 +74,7 @@ public class BroadcastingDispatcher extends AbstractDispatcher implements BeanFa

private MessageHandlingTaskDecorator messageHandlingTaskDecorator = task -> task;

@SuppressWarnings("NullAway.Init")
private BeanFactory beanFactory;

private volatile MessageBuilderFactory messageBuilderFactory = new DefaultMessageBuilderFactory();
Expand All @@ -89,7 +93,7 @@ public BroadcastingDispatcher(boolean requireSubscribers) {
this(null, requireSubscribers);
}

public BroadcastingDispatcher(Executor executor, boolean requireSubscribers) {
public BroadcastingDispatcher(@Nullable Executor executor, boolean requireSubscribers) {
this.requireSubscribers = requireSubscribers;
this.executor = executor;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
*
* @author Artem Bilan
* @author Christian Tzolov
* @author Glenn Renfro
*
* @since 6.1
*/
Expand All @@ -71,10 +72,9 @@ public class PartitionedDispatcher extends AbstractDispatcher {

private Predicate<Exception> failoverStrategy = (exception) -> true;

@Nullable
private LoadBalancingStrategy loadBalancingStrategy;
private @Nullable LoadBalancingStrategy loadBalancingStrategy;

private ErrorHandler errorHandler;
private @Nullable ErrorHandler errorHandler;

private MessageHandlingTaskDecorator messageHandlingTaskDecorator = task -> task;

Expand Down Expand Up @@ -164,6 +164,7 @@ public void shutdown() {
}

@Override
@SuppressWarnings("NullAway") // The partitions map never returns null according to partition hash
public boolean dispatch(Message<?> message) {
populatedPartitions();
int partition = Math.abs(this.partitionKeyFunction.apply(message).hashCode()) % this.partitionCount;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,18 +51,19 @@
* @author Gary Russell
* @author Oleg Zhurakousky
* @author Artem Bilan
* @author Glenn Renfro
*
* @since 1.0.2
*/
public class UnicastingDispatcher extends AbstractDispatcher {

private final MessageHandler dispatchHandler = this::doDispatch;

private final Executor executor;
private final @Nullable Executor executor;

private Predicate<Exception> failoverStrategy = (exception) -> true;

private LoadBalancingStrategy loadBalancingStrategy;
private @Nullable LoadBalancingStrategy loadBalancingStrategy;

private MessageHandlingTaskDecorator messageHandlingTaskDecorator = task -> task;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/**
* Provides classes related to dispatching messages.
*/
@org.jspecify.annotations.NullMarked
package org.springframework.integration.dispatcher;