Switch to JSpecify annotations
This commit updates the whole Spring Framework codebase to use JSpecify annotations instead of Spring null-safety annotations with JSR 305 semantics. JSpecify provides signficant enhancements such as properly defined specifications, a canonical dependency with no split-package issue, better tooling, better Kotlin integration and the capability to specify generic type, array and varargs element null-safety. Generic type null-safety is not defined by this commit yet and will be specified later. A key difference is that Spring null-safety annotations, following JSR 305 semantics, apply to fields, parameters and return values, while JSpecify annotations apply to type usages. That's why this commit moves nullability annotations closer to the type for fields and return values. See gh-28797
This commit is contained in:
@@ -17,9 +17,9 @@
|
||||
package org.springframework.jms;
|
||||
|
||||
import jakarta.jms.JMSException;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
import org.springframework.core.NestedRuntimeException;
|
||||
import org.springframework.lang.Nullable;
|
||||
|
||||
/**
|
||||
* Base class for exception thrown by the framework whenever it
|
||||
@@ -68,8 +68,7 @@ public abstract class JmsException extends NestedRuntimeException {
|
||||
* @return a string specifying the vendor-specific error code if the
|
||||
* root cause is an instance of JMSException, or {@code null}
|
||||
*/
|
||||
@Nullable
|
||||
public String getErrorCode() {
|
||||
public @Nullable String getErrorCode() {
|
||||
Throwable cause = getCause();
|
||||
if (cause instanceof JMSException jmsException) {
|
||||
return jmsException.getErrorCode();
|
||||
@@ -83,8 +82,7 @@ public abstract class JmsException extends NestedRuntimeException {
|
||||
* @see jakarta.jms.JMSException#getLinkedException()
|
||||
*/
|
||||
@Override
|
||||
@Nullable
|
||||
public String getMessage() {
|
||||
public @Nullable String getMessage() {
|
||||
String message = super.getMessage();
|
||||
Throwable cause = getCause();
|
||||
if (cause instanceof JMSException jmsException) {
|
||||
|
||||
@@ -27,6 +27,7 @@ import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
import org.springframework.aop.framework.AopInfrastructureBean;
|
||||
import org.springframework.aop.framework.AopProxyUtils;
|
||||
@@ -52,7 +53,6 @@ import org.springframework.jms.config.JmsListenerContainerFactory;
|
||||
import org.springframework.jms.config.JmsListenerEndpointRegistrar;
|
||||
import org.springframework.jms.config.JmsListenerEndpointRegistry;
|
||||
import org.springframework.jms.config.MethodJmsListenerEndpoint;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.messaging.handler.annotation.support.DefaultMessageHandlerMethodFactory;
|
||||
import org.springframework.messaging.handler.annotation.support.MessageHandlerMethodFactory;
|
||||
import org.springframework.messaging.handler.invocation.InvocableHandlerMethod;
|
||||
@@ -99,20 +99,16 @@ public class JmsListenerAnnotationBeanPostProcessor
|
||||
|
||||
protected final Log logger = LogFactory.getLog(getClass());
|
||||
|
||||
@Nullable
|
||||
private String containerFactoryBeanName = DEFAULT_JMS_LISTENER_CONTAINER_FACTORY_BEAN_NAME;
|
||||
private @Nullable String containerFactoryBeanName = DEFAULT_JMS_LISTENER_CONTAINER_FACTORY_BEAN_NAME;
|
||||
|
||||
@Nullable
|
||||
private JmsListenerEndpointRegistry endpointRegistry;
|
||||
private @Nullable JmsListenerEndpointRegistry endpointRegistry;
|
||||
|
||||
private final MessageHandlerMethodFactoryAdapter messageHandlerMethodFactory =
|
||||
new MessageHandlerMethodFactoryAdapter();
|
||||
|
||||
@Nullable
|
||||
private BeanFactory beanFactory;
|
||||
private @Nullable BeanFactory beanFactory;
|
||||
|
||||
@Nullable
|
||||
private StringValueResolver embeddedValueResolver;
|
||||
private @Nullable StringValueResolver embeddedValueResolver;
|
||||
|
||||
private final JmsListenerEndpointRegistrar registrar = new JmsListenerEndpointRegistrar();
|
||||
|
||||
@@ -324,8 +320,7 @@ public class JmsListenerAnnotationBeanPostProcessor
|
||||
}
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private String resolve(String value) {
|
||||
private @Nullable String resolve(String value) {
|
||||
return (this.embeddedValueResolver != null ? this.embeddedValueResolver.resolveStringValue(value) : value);
|
||||
}
|
||||
|
||||
@@ -338,8 +333,7 @@ public class JmsListenerAnnotationBeanPostProcessor
|
||||
*/
|
||||
private class MessageHandlerMethodFactoryAdapter implements MessageHandlerMethodFactory {
|
||||
|
||||
@Nullable
|
||||
private MessageHandlerMethodFactory messageHandlerMethodFactory;
|
||||
private @Nullable MessageHandlerMethodFactory messageHandlerMethodFactory;
|
||||
|
||||
public void setMessageHandlerMethodFactory(MessageHandlerMethodFactory messageHandlerMethodFactory) {
|
||||
this.messageHandlerMethodFactory = messageHandlerMethodFactory;
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
/**
|
||||
* Annotations and support classes for declarative JMS listener endpoints.
|
||||
*/
|
||||
@NonNullApi
|
||||
@NonNullFields
|
||||
@NullMarked
|
||||
package org.springframework.jms.annotation;
|
||||
|
||||
import org.springframework.lang.NonNullApi;
|
||||
import org.springframework.lang.NonNullFields;
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
|
||||
@@ -21,12 +21,12 @@ import jakarta.jms.ConnectionFactory;
|
||||
import jakarta.jms.ExceptionListener;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
import org.springframework.jms.listener.AbstractMessageListenerContainer;
|
||||
import org.springframework.jms.support.QosSettings;
|
||||
import org.springframework.jms.support.converter.MessageConverter;
|
||||
import org.springframework.jms.support.destination.DestinationResolver;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.util.ErrorHandler;
|
||||
|
||||
/**
|
||||
@@ -42,53 +42,37 @@ public abstract class AbstractJmsListenerContainerFactory<C extends AbstractMess
|
||||
|
||||
protected final Log logger = LogFactory.getLog(getClass());
|
||||
|
||||
@Nullable
|
||||
private ConnectionFactory connectionFactory;
|
||||
private @Nullable ConnectionFactory connectionFactory;
|
||||
|
||||
@Nullable
|
||||
private DestinationResolver destinationResolver;
|
||||
private @Nullable DestinationResolver destinationResolver;
|
||||
|
||||
@Nullable
|
||||
private MessageConverter messageConverter;
|
||||
private @Nullable MessageConverter messageConverter;
|
||||
|
||||
@Nullable
|
||||
private ExceptionListener exceptionListener;
|
||||
private @Nullable ExceptionListener exceptionListener;
|
||||
|
||||
@Nullable
|
||||
private ErrorHandler errorHandler;
|
||||
private @Nullable ErrorHandler errorHandler;
|
||||
|
||||
@Nullable
|
||||
private Boolean sessionTransacted;
|
||||
private @Nullable Boolean sessionTransacted;
|
||||
|
||||
@Nullable
|
||||
private Integer sessionAcknowledgeMode;
|
||||
private @Nullable Integer sessionAcknowledgeMode;
|
||||
|
||||
@Nullable
|
||||
private Boolean pubSubDomain;
|
||||
private @Nullable Boolean pubSubDomain;
|
||||
|
||||
@Nullable
|
||||
private Boolean replyPubSubDomain;
|
||||
private @Nullable Boolean replyPubSubDomain;
|
||||
|
||||
@Nullable
|
||||
private QosSettings replyQosSettings;
|
||||
private @Nullable QosSettings replyQosSettings;
|
||||
|
||||
@Nullable
|
||||
private Boolean subscriptionDurable;
|
||||
private @Nullable Boolean subscriptionDurable;
|
||||
|
||||
@Nullable
|
||||
private Boolean subscriptionShared;
|
||||
private @Nullable Boolean subscriptionShared;
|
||||
|
||||
@Nullable
|
||||
private String clientId;
|
||||
private @Nullable String clientId;
|
||||
|
||||
@Nullable
|
||||
private Integer phase;
|
||||
private @Nullable Integer phase;
|
||||
|
||||
@Nullable
|
||||
private Boolean autoStartup;
|
||||
private @Nullable Boolean autoStartup;
|
||||
|
||||
@Nullable
|
||||
private ObservationRegistry observationRegistry;
|
||||
private @Nullable ObservationRegistry observationRegistry;
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@@ -17,12 +17,12 @@
|
||||
package org.springframework.jms.config;
|
||||
|
||||
import jakarta.jms.MessageListener;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
import org.springframework.jms.listener.AbstractMessageListenerContainer;
|
||||
import org.springframework.jms.listener.MessageListenerContainer;
|
||||
import org.springframework.jms.listener.endpoint.JmsActivationSpecConfig;
|
||||
import org.springframework.jms.listener.endpoint.JmsMessageEndpointManager;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
/**
|
||||
@@ -38,17 +38,13 @@ public abstract class AbstractJmsListenerEndpoint implements JmsListenerEndpoint
|
||||
|
||||
private String id = "";
|
||||
|
||||
@Nullable
|
||||
private String destination;
|
||||
private @Nullable String destination;
|
||||
|
||||
@Nullable
|
||||
private String subscription;
|
||||
private @Nullable String subscription;
|
||||
|
||||
@Nullable
|
||||
private String selector;
|
||||
private @Nullable String selector;
|
||||
|
||||
@Nullable
|
||||
private String concurrency;
|
||||
private @Nullable String concurrency;
|
||||
|
||||
|
||||
/**
|
||||
@@ -76,8 +72,7 @@ public abstract class AbstractJmsListenerEndpoint implements JmsListenerEndpoint
|
||||
/**
|
||||
* Return the name of the destination for this endpoint.
|
||||
*/
|
||||
@Nullable
|
||||
public String getDestination() {
|
||||
public @Nullable String getDestination() {
|
||||
return this.destination;
|
||||
}
|
||||
|
||||
@@ -91,8 +86,7 @@ public abstract class AbstractJmsListenerEndpoint implements JmsListenerEndpoint
|
||||
/**
|
||||
* Return the name for the durable subscription, if any.
|
||||
*/
|
||||
@Nullable
|
||||
public String getSubscription() {
|
||||
public @Nullable String getSubscription() {
|
||||
return this.subscription;
|
||||
}
|
||||
|
||||
@@ -107,8 +101,7 @@ public abstract class AbstractJmsListenerEndpoint implements JmsListenerEndpoint
|
||||
/**
|
||||
* Return the JMS message selector expression, if any.
|
||||
*/
|
||||
@Nullable
|
||||
public String getSelector() {
|
||||
public @Nullable String getSelector() {
|
||||
return this.selector;
|
||||
}
|
||||
|
||||
@@ -126,8 +119,7 @@ public abstract class AbstractJmsListenerEndpoint implements JmsListenerEndpoint
|
||||
/**
|
||||
* Return the concurrency for the listener, if any.
|
||||
*/
|
||||
@Nullable
|
||||
public String getConcurrency() {
|
||||
public @Nullable String getConcurrency() {
|
||||
return this.concurrency;
|
||||
}
|
||||
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
package org.springframework.jms.config;
|
||||
|
||||
import jakarta.jms.Session;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
import org.w3c.dom.Element;
|
||||
import org.w3c.dom.Node;
|
||||
import org.w3c.dom.NodeList;
|
||||
@@ -31,7 +32,6 @@ import org.springframework.beans.factory.parsing.CompositeComponentDefinition;
|
||||
import org.springframework.beans.factory.support.RootBeanDefinition;
|
||||
import org.springframework.beans.factory.xml.BeanDefinitionParser;
|
||||
import org.springframework.beans.factory.xml.ParserContext;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
/**
|
||||
@@ -102,8 +102,7 @@ abstract class AbstractListenerContainerParser implements BeanDefinitionParser {
|
||||
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public BeanDefinition parse(Element element, ParserContext parserContext) {
|
||||
public @Nullable BeanDefinition parse(Element element, ParserContext parserContext) {
|
||||
CompositeComponentDefinition compositeDef =
|
||||
new CompositeComponentDefinition(element.getTagName(), parserContext.extractSource(element));
|
||||
parserContext.pushContainingComponent(compositeDef);
|
||||
@@ -313,8 +312,7 @@ abstract class AbstractListenerContainerParser implements BeanDefinitionParser {
|
||||
* Create the {@link BeanDefinition} for the container factory using the specified
|
||||
* shared property values.
|
||||
*/
|
||||
@Nullable
|
||||
protected abstract RootBeanDefinition createContainerFactory(String factoryId, Element containerEle, ParserContext parserContext,
|
||||
protected abstract @Nullable RootBeanDefinition createContainerFactory(String factoryId, Element containerEle, ParserContext parserContext,
|
||||
PropertyValues commonContainerProperties, PropertyValues specificContainerProperties);
|
||||
|
||||
/**
|
||||
@@ -324,8 +322,7 @@ abstract class AbstractListenerContainerParser implements BeanDefinitionParser {
|
||||
PropertyValues commonContainerProperties, PropertyValues specificContainerProperties);
|
||||
|
||||
|
||||
@Nullable
|
||||
protected Integer parseAcknowledgeMode(Element ele, ParserContext parserContext) {
|
||||
protected @Nullable Integer parseAcknowledgeMode(Element ele, ParserContext parserContext) {
|
||||
String acknowledge = ele.getAttribute(ACKNOWLEDGE_ATTRIBUTE);
|
||||
if (StringUtils.hasText(acknowledge)) {
|
||||
int acknowledgeMode = Session.AUTO_ACKNOWLEDGE;
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
|
||||
package org.springframework.jms.config;
|
||||
|
||||
import org.jspecify.annotations.Nullable;
|
||||
import org.w3c.dom.Element;
|
||||
|
||||
import org.springframework.beans.factory.config.BeanDefinition;
|
||||
@@ -26,7 +27,6 @@ import org.springframework.beans.factory.support.BeanDefinitionBuilder;
|
||||
import org.springframework.beans.factory.support.BeanDefinitionRegistry;
|
||||
import org.springframework.beans.factory.xml.BeanDefinitionParser;
|
||||
import org.springframework.beans.factory.xml.ParserContext;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
/**
|
||||
@@ -38,8 +38,7 @@ import org.springframework.util.StringUtils;
|
||||
class AnnotationDrivenJmsBeanDefinitionParser implements BeanDefinitionParser {
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public BeanDefinition parse(Element element, ParserContext parserContext) {
|
||||
public @Nullable BeanDefinition parse(Element element, ParserContext parserContext) {
|
||||
Object source = parserContext.extractSource(element);
|
||||
|
||||
// Register component for the surrounding <jms:annotation-driven> element.
|
||||
|
||||
@@ -17,12 +17,12 @@
|
||||
package org.springframework.jms.config;
|
||||
|
||||
import jakarta.resource.spi.ResourceAdapter;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
import org.springframework.jms.listener.endpoint.JmsActivationSpecConfig;
|
||||
import org.springframework.jms.listener.endpoint.JmsActivationSpecFactory;
|
||||
import org.springframework.jms.listener.endpoint.JmsMessageEndpointManager;
|
||||
import org.springframework.jms.support.destination.DestinationResolver;
|
||||
import org.springframework.lang.Nullable;
|
||||
|
||||
/**
|
||||
* A {@link JmsListenerContainerFactory} implementation to build a
|
||||
@@ -34,20 +34,15 @@ import org.springframework.lang.Nullable;
|
||||
public class DefaultJcaListenerContainerFactory extends JmsActivationSpecConfig
|
||||
implements JmsListenerContainerFactory<JmsMessageEndpointManager> {
|
||||
|
||||
@Nullable
|
||||
private ResourceAdapter resourceAdapter;
|
||||
private @Nullable ResourceAdapter resourceAdapter;
|
||||
|
||||
@Nullable
|
||||
private JmsActivationSpecFactory activationSpecFactory;
|
||||
private @Nullable JmsActivationSpecFactory activationSpecFactory;
|
||||
|
||||
@Nullable
|
||||
private DestinationResolver destinationResolver;
|
||||
private @Nullable DestinationResolver destinationResolver;
|
||||
|
||||
@Nullable
|
||||
private Object transactionManager;
|
||||
private @Nullable Object transactionManager;
|
||||
|
||||
@Nullable
|
||||
private Integer phase;
|
||||
private @Nullable Integer phase;
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@@ -18,8 +18,9 @@ package org.springframework.jms.config;
|
||||
|
||||
import java.util.concurrent.Executor;
|
||||
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
import org.springframework.jms.listener.DefaultMessageListenerContainer;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.transaction.PlatformTransactionManager;
|
||||
import org.springframework.util.backoff.BackOff;
|
||||
|
||||
@@ -36,32 +37,23 @@ import org.springframework.util.backoff.BackOff;
|
||||
public class DefaultJmsListenerContainerFactory
|
||||
extends AbstractJmsListenerContainerFactory<DefaultMessageListenerContainer> {
|
||||
|
||||
@Nullable
|
||||
private Executor taskExecutor;
|
||||
private @Nullable Executor taskExecutor;
|
||||
|
||||
@Nullable
|
||||
private PlatformTransactionManager transactionManager;
|
||||
private @Nullable PlatformTransactionManager transactionManager;
|
||||
|
||||
@Nullable
|
||||
private Integer cacheLevel;
|
||||
private @Nullable Integer cacheLevel;
|
||||
|
||||
@Nullable
|
||||
private String cacheLevelName;
|
||||
private @Nullable String cacheLevelName;
|
||||
|
||||
@Nullable
|
||||
private String concurrency;
|
||||
private @Nullable String concurrency;
|
||||
|
||||
@Nullable
|
||||
private Integer maxMessagesPerTask;
|
||||
private @Nullable Integer maxMessagesPerTask;
|
||||
|
||||
@Nullable
|
||||
private Long receiveTimeout;
|
||||
private @Nullable Long receiveTimeout;
|
||||
|
||||
@Nullable
|
||||
private Long recoveryInterval;
|
||||
private @Nullable Long recoveryInterval;
|
||||
|
||||
@Nullable
|
||||
private BackOff backOff;
|
||||
private @Nullable BackOff backOff;
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@@ -19,6 +19,7 @@ package org.springframework.jms.config;
|
||||
import java.util.Locale;
|
||||
|
||||
import jakarta.jms.Session;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
import org.w3c.dom.Element;
|
||||
|
||||
import org.springframework.beans.MutablePropertyValues;
|
||||
@@ -26,7 +27,6 @@ import org.springframework.beans.PropertyValues;
|
||||
import org.springframework.beans.factory.config.RuntimeBeanReference;
|
||||
import org.springframework.beans.factory.support.RootBeanDefinition;
|
||||
import org.springframework.beans.factory.xml.ParserContext;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
/**
|
||||
@@ -59,8 +59,7 @@ class JmsListenerContainerParser extends AbstractListenerContainerParser {
|
||||
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
protected RootBeanDefinition createContainerFactory(String factoryId, Element containerEle, ParserContext parserContext,
|
||||
protected @Nullable RootBeanDefinition createContainerFactory(String factoryId, Element containerEle, ParserContext parserContext,
|
||||
PropertyValues commonContainerProperties, PropertyValues specificContainerProperties) {
|
||||
|
||||
RootBeanDefinition factoryDef = new RootBeanDefinition();
|
||||
|
||||
@@ -19,10 +19,11 @@ package org.springframework.jms.config;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
import org.springframework.beans.factory.BeanFactory;
|
||||
import org.springframework.beans.factory.BeanFactoryAware;
|
||||
import org.springframework.beans.factory.InitializingBean;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.messaging.handler.annotation.support.DefaultMessageHandlerMethodFactory;
|
||||
import org.springframework.messaging.handler.annotation.support.MessageHandlerMethodFactory;
|
||||
import org.springframework.util.Assert;
|
||||
@@ -37,20 +38,15 @@ import org.springframework.util.Assert;
|
||||
*/
|
||||
public class JmsListenerEndpointRegistrar implements BeanFactoryAware, InitializingBean {
|
||||
|
||||
@Nullable
|
||||
private JmsListenerEndpointRegistry endpointRegistry;
|
||||
private @Nullable JmsListenerEndpointRegistry endpointRegistry;
|
||||
|
||||
@Nullable
|
||||
private MessageHandlerMethodFactory messageHandlerMethodFactory;
|
||||
private @Nullable MessageHandlerMethodFactory messageHandlerMethodFactory;
|
||||
|
||||
@Nullable
|
||||
private JmsListenerContainerFactory<?> containerFactory;
|
||||
private @Nullable JmsListenerContainerFactory<?> containerFactory;
|
||||
|
||||
@Nullable
|
||||
private String containerFactoryBeanName;
|
||||
private @Nullable String containerFactoryBeanName;
|
||||
|
||||
@Nullable
|
||||
private BeanFactory beanFactory;
|
||||
private @Nullable BeanFactory beanFactory;
|
||||
|
||||
private final List<JmsListenerEndpointDescriptor> endpointDescriptors = new ArrayList<>();
|
||||
|
||||
@@ -68,8 +64,7 @@ public class JmsListenerEndpointRegistrar implements BeanFactoryAware, Initializ
|
||||
* Return the {@link JmsListenerEndpointRegistry} instance for this
|
||||
* registrar, may be {@code null}.
|
||||
*/
|
||||
@Nullable
|
||||
public JmsListenerEndpointRegistry getEndpointRegistry() {
|
||||
public @Nullable JmsListenerEndpointRegistry getEndpointRegistry() {
|
||||
return this.endpointRegistry;
|
||||
}
|
||||
|
||||
@@ -88,8 +83,7 @@ public class JmsListenerEndpointRegistrar implements BeanFactoryAware, Initializ
|
||||
/**
|
||||
* Return the custom {@link MessageHandlerMethodFactory} to use, if any.
|
||||
*/
|
||||
@Nullable
|
||||
public MessageHandlerMethodFactory getMessageHandlerMethodFactory() {
|
||||
public @Nullable MessageHandlerMethodFactory getMessageHandlerMethodFactory() {
|
||||
return this.messageHandlerMethodFactory;
|
||||
}
|
||||
|
||||
@@ -197,8 +191,7 @@ public class JmsListenerEndpointRegistrar implements BeanFactoryAware, Initializ
|
||||
|
||||
public final JmsListenerEndpoint endpoint;
|
||||
|
||||
@Nullable
|
||||
public final JmsListenerContainerFactory<?> containerFactory;
|
||||
public final @Nullable JmsListenerContainerFactory<?> containerFactory;
|
||||
|
||||
public JmsListenerEndpointDescriptor(JmsListenerEndpoint endpoint,
|
||||
@Nullable JmsListenerContainerFactory<?> containerFactory) {
|
||||
|
||||
@@ -25,6 +25,7 @@ import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
import org.springframework.beans.factory.BeanInitializationException;
|
||||
import org.springframework.beans.factory.DisposableBean;
|
||||
@@ -35,7 +36,6 @@ import org.springframework.context.ApplicationListener;
|
||||
import org.springframework.context.SmartLifecycle;
|
||||
import org.springframework.context.event.ContextRefreshedEvent;
|
||||
import org.springframework.jms.listener.MessageListenerContainer;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
/**
|
||||
@@ -69,8 +69,7 @@ public class JmsListenerEndpointRegistry implements DisposableBean, SmartLifecyc
|
||||
|
||||
private int phase = DEFAULT_PHASE;
|
||||
|
||||
@Nullable
|
||||
private ApplicationContext applicationContext;
|
||||
private @Nullable ApplicationContext applicationContext;
|
||||
|
||||
private boolean contextRefreshed;
|
||||
|
||||
@@ -96,8 +95,7 @@ public class JmsListenerEndpointRegistry implements DisposableBean, SmartLifecyc
|
||||
* @see JmsListenerEndpoint#getId()
|
||||
* @see #getListenerContainerIds()
|
||||
*/
|
||||
@Nullable
|
||||
public MessageListenerContainer getListenerContainer(String id) {
|
||||
public @Nullable MessageListenerContainer getListenerContainer(String id) {
|
||||
Assert.notNull(id, "Container identifier must not be null");
|
||||
return this.listenerContainers.get(id);
|
||||
}
|
||||
|
||||
@@ -19,6 +19,8 @@ package org.springframework.jms.config;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.Arrays;
|
||||
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
import org.springframework.aop.framework.AopProxyUtils;
|
||||
import org.springframework.aop.support.AopUtils;
|
||||
import org.springframework.beans.factory.BeanFactory;
|
||||
@@ -31,7 +33,6 @@ import org.springframework.jms.listener.adapter.MessagingMessageListenerAdapter;
|
||||
import org.springframework.jms.support.QosSettings;
|
||||
import org.springframework.jms.support.converter.MessageConverter;
|
||||
import org.springframework.jms.support.destination.DestinationResolver;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.messaging.handler.annotation.SendTo;
|
||||
import org.springframework.messaging.handler.annotation.support.MessageHandlerMethodFactory;
|
||||
import org.springframework.messaging.handler.invocation.InvocableHandlerMethod;
|
||||
@@ -49,20 +50,15 @@ import org.springframework.util.StringValueResolver;
|
||||
*/
|
||||
public class MethodJmsListenerEndpoint extends AbstractJmsListenerEndpoint implements BeanFactoryAware {
|
||||
|
||||
@Nullable
|
||||
private Object bean;
|
||||
private @Nullable Object bean;
|
||||
|
||||
@Nullable
|
||||
private Method method;
|
||||
private @Nullable Method method;
|
||||
|
||||
@Nullable
|
||||
private Method mostSpecificMethod;
|
||||
private @Nullable Method mostSpecificMethod;
|
||||
|
||||
@Nullable
|
||||
private MessageHandlerMethodFactory messageHandlerMethodFactory;
|
||||
private @Nullable MessageHandlerMethodFactory messageHandlerMethodFactory;
|
||||
|
||||
@Nullable
|
||||
private StringValueResolver embeddedValueResolver;
|
||||
private @Nullable StringValueResolver embeddedValueResolver;
|
||||
|
||||
|
||||
/**
|
||||
@@ -72,8 +68,7 @@ public class MethodJmsListenerEndpoint extends AbstractJmsListenerEndpoint imple
|
||||
this.bean = bean;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public Object getBean() {
|
||||
public @Nullable Object getBean() {
|
||||
return this.bean;
|
||||
}
|
||||
|
||||
@@ -84,8 +79,7 @@ public class MethodJmsListenerEndpoint extends AbstractJmsListenerEndpoint imple
|
||||
this.method = method;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public Method getMethod() {
|
||||
public @Nullable Method getMethod() {
|
||||
return this.method;
|
||||
}
|
||||
|
||||
@@ -99,8 +93,7 @@ public class MethodJmsListenerEndpoint extends AbstractJmsListenerEndpoint imple
|
||||
this.mostSpecificMethod = mostSpecificMethod;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public Method getMostSpecificMethod() {
|
||||
public @Nullable Method getMostSpecificMethod() {
|
||||
if (this.mostSpecificMethod != null) {
|
||||
return this.mostSpecificMethod;
|
||||
}
|
||||
@@ -188,8 +181,7 @@ public class MethodJmsListenerEndpoint extends AbstractJmsListenerEndpoint imple
|
||||
/**
|
||||
* Return the default response destination, if any.
|
||||
*/
|
||||
@Nullable
|
||||
protected String getDefaultResponseDestination() {
|
||||
protected @Nullable String getDefaultResponseDestination() {
|
||||
Method specificMethod = getMostSpecificMethod();
|
||||
if (specificMethod == null) {
|
||||
return null;
|
||||
@@ -206,8 +198,7 @@ public class MethodJmsListenerEndpoint extends AbstractJmsListenerEndpoint imple
|
||||
return null;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private SendTo getSendTo(Method specificMethod) {
|
||||
private @Nullable SendTo getSendTo(Method specificMethod) {
|
||||
SendTo ann = AnnotatedElementUtils.findMergedAnnotation(specificMethod, SendTo.class);
|
||||
if (ann == null) {
|
||||
ann = AnnotatedElementUtils.findMergedAnnotation(specificMethod.getDeclaringClass(), SendTo.class);
|
||||
@@ -215,8 +206,7 @@ public class MethodJmsListenerEndpoint extends AbstractJmsListenerEndpoint imple
|
||||
return ann;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private String resolve(String value) {
|
||||
private @Nullable String resolve(String value) {
|
||||
return (this.embeddedValueResolver != null ? this.embeddedValueResolver.resolveStringValue(value) : value);
|
||||
}
|
||||
|
||||
|
||||
@@ -17,9 +17,9 @@
|
||||
package org.springframework.jms.config;
|
||||
|
||||
import jakarta.jms.MessageListener;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
import org.springframework.jms.listener.MessageListenerContainer;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
/**
|
||||
@@ -31,8 +31,7 @@ import org.springframework.util.Assert;
|
||||
*/
|
||||
public class SimpleJmsListenerEndpoint extends AbstractJmsListenerEndpoint {
|
||||
|
||||
@Nullable
|
||||
private MessageListener messageListener;
|
||||
private @Nullable MessageListener messageListener;
|
||||
|
||||
|
||||
/**
|
||||
@@ -47,8 +46,7 @@ public class SimpleJmsListenerEndpoint extends AbstractJmsListenerEndpoint {
|
||||
* Return the {@link MessageListener} to invoke when a message matching
|
||||
* the endpoint is received.
|
||||
*/
|
||||
@Nullable
|
||||
public MessageListener getMessageListener() {
|
||||
public @Nullable MessageListener getMessageListener() {
|
||||
return this.messageListener;
|
||||
}
|
||||
|
||||
|
||||
@@ -2,9 +2,7 @@
|
||||
* Support package for declarative messaging configuration,
|
||||
* with Java configuration and XML schema support.
|
||||
*/
|
||||
@NonNullApi
|
||||
@NonNullFields
|
||||
@NullMarked
|
||||
package org.springframework.jms.config;
|
||||
|
||||
import org.springframework.lang.NonNullApi;
|
||||
import org.springframework.lang.NonNullFields;
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
|
||||
@@ -24,8 +24,7 @@ import jakarta.jms.Queue;
|
||||
import jakarta.jms.QueueReceiver;
|
||||
import jakarta.jms.Topic;
|
||||
import jakarta.jms.TopicSubscriber;
|
||||
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
/**
|
||||
* JMS MessageConsumer decorator that adapts all calls
|
||||
@@ -50,14 +49,12 @@ class CachedMessageConsumer implements MessageConsumer, QueueReceiver, TopicSubs
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public Queue getQueue() throws JMSException {
|
||||
public @Nullable Queue getQueue() throws JMSException {
|
||||
return (this.target instanceof QueueReceiver receiver ? receiver.getQueue() : null);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public Topic getTopic() throws JMSException {
|
||||
public @Nullable Topic getTopic() throws JMSException {
|
||||
return (this.target instanceof TopicSubscriber subscriber ? subscriber.getTopic() : null);
|
||||
}
|
||||
|
||||
|
||||
@@ -25,8 +25,7 @@ import jakarta.jms.Queue;
|
||||
import jakarta.jms.QueueSender;
|
||||
import jakarta.jms.Topic;
|
||||
import jakarta.jms.TopicPublisher;
|
||||
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
/**
|
||||
* JMS MessageProducer decorator that adapts calls to a shared MessageProducer
|
||||
@@ -39,14 +38,11 @@ class CachedMessageProducer implements MessageProducer, QueueSender, TopicPublis
|
||||
|
||||
private final MessageProducer target;
|
||||
|
||||
@Nullable
|
||||
private Boolean originalDisableMessageID;
|
||||
private @Nullable Boolean originalDisableMessageID;
|
||||
|
||||
@Nullable
|
||||
private Boolean originalDisableMessageTimestamp;
|
||||
private @Nullable Boolean originalDisableMessageTimestamp;
|
||||
|
||||
@Nullable
|
||||
private Long originalDeliveryDelay;
|
||||
private @Nullable Long originalDeliveryDelay;
|
||||
|
||||
private int deliveryMode;
|
||||
|
||||
|
||||
@@ -42,8 +42,8 @@ import jakarta.jms.TemporaryQueue;
|
||||
import jakarta.jms.TemporaryTopic;
|
||||
import jakarta.jms.Topic;
|
||||
import jakarta.jms.TopicSession;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.ClassUtils;
|
||||
import org.springframework.util.ObjectUtils;
|
||||
@@ -240,8 +240,7 @@ public class CachingConnectionFactory extends SingleConnectionFactory {
|
||||
* Checks for a cached Session for the given mode.
|
||||
*/
|
||||
@Override
|
||||
@Nullable
|
||||
protected Session getSession(Connection con, Integer mode) throws JMSException {
|
||||
protected @Nullable Session getSession(Connection con, Integer mode) throws JMSException {
|
||||
if (!this.active) {
|
||||
return null;
|
||||
}
|
||||
@@ -312,8 +311,7 @@ public class CachingConnectionFactory extends SingleConnectionFactory {
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
|
||||
public @Nullable Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
|
||||
String methodName = method.getName();
|
||||
if (methodName.equals("equals")) {
|
||||
// Only consider equal when proxies are identical.
|
||||
@@ -538,8 +536,7 @@ public class CachingConnectionFactory extends SingleConnectionFactory {
|
||||
|
||||
private final Destination destination;
|
||||
|
||||
@Nullable
|
||||
private String destinationString;
|
||||
private @Nullable String destinationString;
|
||||
|
||||
public DestinationCacheKey(Destination destination) {
|
||||
Assert.notNull(destination, "Destination must not be null");
|
||||
@@ -592,14 +589,11 @@ public class CachingConnectionFactory extends SingleConnectionFactory {
|
||||
*/
|
||||
private static class ConsumerCacheKey extends DestinationCacheKey {
|
||||
|
||||
@Nullable
|
||||
private final String selector;
|
||||
private final @Nullable String selector;
|
||||
|
||||
@Nullable
|
||||
private final Boolean noLocal;
|
||||
private final @Nullable Boolean noLocal;
|
||||
|
||||
@Nullable
|
||||
private final String subscription;
|
||||
private final @Nullable String subscription;
|
||||
|
||||
private final boolean durable;
|
||||
|
||||
|
||||
@@ -21,11 +21,11 @@ import jakarta.jms.QueueConnection;
|
||||
import jakarta.jms.QueueSession;
|
||||
import jakarta.jms.TopicConnection;
|
||||
import jakarta.jms.TopicSession;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
import org.springframework.aot.hint.RuntimeHints;
|
||||
import org.springframework.aot.hint.RuntimeHintsRegistrar;
|
||||
import org.springframework.aot.hint.TypeReference;
|
||||
import org.springframework.lang.Nullable;
|
||||
|
||||
/**
|
||||
* {@link RuntimeHintsRegistrar} to register hints for JMS connection factories.
|
||||
|
||||
@@ -28,8 +28,8 @@ import jakarta.jms.TopicConnectionFactory;
|
||||
import jakarta.jms.TopicSession;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.transaction.support.ResourceHolderSynchronization;
|
||||
import org.springframework.transaction.support.TransactionSynchronizationManager;
|
||||
import org.springframework.util.Assert;
|
||||
@@ -131,20 +131,17 @@ public abstract class ConnectionFactoryUtils {
|
||||
* @return the transactional Session, or {@code null} if none found
|
||||
* @throws JMSException in case of JMS failure
|
||||
*/
|
||||
@Nullable
|
||||
public static Session getTransactionalSession(final ConnectionFactory cf,
|
||||
@Nullable final Connection existingCon, final boolean synchedLocalTransactionAllowed)
|
||||
public static @Nullable Session getTransactionalSession(final ConnectionFactory cf,
|
||||
final @Nullable Connection existingCon, final boolean synchedLocalTransactionAllowed)
|
||||
throws JMSException {
|
||||
|
||||
return doGetTransactionalSession(cf, new ResourceFactory() {
|
||||
@Override
|
||||
@Nullable
|
||||
public Session getSession(JmsResourceHolder holder) {
|
||||
public @Nullable Session getSession(JmsResourceHolder holder) {
|
||||
return holder.getSession(Session.class, existingCon);
|
||||
}
|
||||
@Override
|
||||
@Nullable
|
||||
public Connection getConnection(JmsResourceHolder holder) {
|
||||
public @Nullable Connection getConnection(JmsResourceHolder holder) {
|
||||
return (existingCon != null ? existingCon : holder.getConnection());
|
||||
}
|
||||
@Override
|
||||
@@ -176,20 +173,17 @@ public abstract class ConnectionFactoryUtils {
|
||||
* @return the transactional Session, or {@code null} if none found
|
||||
* @throws JMSException in case of JMS failure
|
||||
*/
|
||||
@Nullable
|
||||
public static QueueSession getTransactionalQueueSession(final QueueConnectionFactory cf,
|
||||
@Nullable final QueueConnection existingCon, final boolean synchedLocalTransactionAllowed)
|
||||
public static @Nullable QueueSession getTransactionalQueueSession(final QueueConnectionFactory cf,
|
||||
final @Nullable QueueConnection existingCon, final boolean synchedLocalTransactionAllowed)
|
||||
throws JMSException {
|
||||
|
||||
return (QueueSession) doGetTransactionalSession(cf, new ResourceFactory() {
|
||||
@Override
|
||||
@Nullable
|
||||
public Session getSession(JmsResourceHolder holder) {
|
||||
public @Nullable Session getSession(JmsResourceHolder holder) {
|
||||
return holder.getSession(QueueSession.class, existingCon);
|
||||
}
|
||||
@Override
|
||||
@Nullable
|
||||
public Connection getConnection(JmsResourceHolder holder) {
|
||||
public @Nullable Connection getConnection(JmsResourceHolder holder) {
|
||||
return (existingCon != null ? existingCon : holder.getConnection(QueueConnection.class));
|
||||
}
|
||||
@Override
|
||||
@@ -221,20 +215,17 @@ public abstract class ConnectionFactoryUtils {
|
||||
* @return the transactional Session, or {@code null} if none found
|
||||
* @throws JMSException in case of JMS failure
|
||||
*/
|
||||
@Nullable
|
||||
public static TopicSession getTransactionalTopicSession(final TopicConnectionFactory cf,
|
||||
@Nullable final TopicConnection existingCon, final boolean synchedLocalTransactionAllowed)
|
||||
public static @Nullable TopicSession getTransactionalTopicSession(final TopicConnectionFactory cf,
|
||||
final @Nullable TopicConnection existingCon, final boolean synchedLocalTransactionAllowed)
|
||||
throws JMSException {
|
||||
|
||||
return (TopicSession) doGetTransactionalSession(cf, new ResourceFactory() {
|
||||
@Override
|
||||
@Nullable
|
||||
public Session getSession(JmsResourceHolder holder) {
|
||||
public @Nullable Session getSession(JmsResourceHolder holder) {
|
||||
return holder.getSession(TopicSession.class, existingCon);
|
||||
}
|
||||
@Override
|
||||
@Nullable
|
||||
public Connection getConnection(JmsResourceHolder holder) {
|
||||
public @Nullable Connection getConnection(JmsResourceHolder holder) {
|
||||
return (existingCon != null ? existingCon : holder.getConnection(TopicConnection.class));
|
||||
}
|
||||
@Override
|
||||
@@ -265,8 +256,7 @@ public abstract class ConnectionFactoryUtils {
|
||||
* @throws JMSException in case of JMS failure
|
||||
* @see #doGetTransactionalSession(jakarta.jms.ConnectionFactory, ResourceFactory, boolean)
|
||||
*/
|
||||
@Nullable
|
||||
public static Session doGetTransactionalSession(
|
||||
public static @Nullable Session doGetTransactionalSession(
|
||||
ConnectionFactory connectionFactory, ResourceFactory resourceFactory) throws JMSException {
|
||||
|
||||
return doGetTransactionalSession(connectionFactory, resourceFactory, true);
|
||||
@@ -284,9 +274,8 @@ public abstract class ConnectionFactoryUtils {
|
||||
* @return the transactional Session, or {@code null} if none found
|
||||
* @throws JMSException in case of JMS failure
|
||||
*/
|
||||
@Nullable
|
||||
@SuppressWarnings("NullAway")
|
||||
public static Session doGetTransactionalSession(
|
||||
public static @Nullable Session doGetTransactionalSession(
|
||||
ConnectionFactory connectionFactory, ResourceFactory resourceFactory, boolean startConnection)
|
||||
throws JMSException {
|
||||
|
||||
@@ -373,8 +362,7 @@ public abstract class ConnectionFactoryUtils {
|
||||
* @return an appropriate Session fetched from the holder,
|
||||
* or {@code null} if none found
|
||||
*/
|
||||
@Nullable
|
||||
Session getSession(JmsResourceHolder holder);
|
||||
@Nullable Session getSession(JmsResourceHolder holder);
|
||||
|
||||
/**
|
||||
* Fetch an appropriate Connection from the given JmsResourceHolder.
|
||||
@@ -382,8 +370,7 @@ public abstract class ConnectionFactoryUtils {
|
||||
* @return an appropriate Connection fetched from the holder,
|
||||
* or {@code null} if none found
|
||||
*/
|
||||
@Nullable
|
||||
Connection getConnection(JmsResourceHolder holder);
|
||||
@Nullable Connection getConnection(JmsResourceHolder holder);
|
||||
|
||||
/**
|
||||
* Create a new JMS Connection for registration with a JmsResourceHolder.
|
||||
|
||||
@@ -24,9 +24,9 @@ import jakarta.jms.QueueConnection;
|
||||
import jakarta.jms.QueueConnectionFactory;
|
||||
import jakarta.jms.TopicConnection;
|
||||
import jakarta.jms.TopicConnectionFactory;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
import org.springframework.beans.factory.InitializingBean;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
/**
|
||||
@@ -60,8 +60,7 @@ import org.springframework.util.Assert;
|
||||
public class DelegatingConnectionFactory
|
||||
implements SmartConnectionFactory, QueueConnectionFactory, TopicConnectionFactory, InitializingBean {
|
||||
|
||||
@Nullable
|
||||
private ConnectionFactory targetConnectionFactory;
|
||||
private @Nullable ConnectionFactory targetConnectionFactory;
|
||||
|
||||
private boolean shouldStopConnections = false;
|
||||
|
||||
@@ -76,8 +75,7 @@ public class DelegatingConnectionFactory
|
||||
/**
|
||||
* Return the target ConnectionFactory that this ConnectionFactory delegates to.
|
||||
*/
|
||||
@Nullable
|
||||
public ConnectionFactory getTargetConnectionFactory() {
|
||||
public @Nullable ConnectionFactory getTargetConnectionFactory() {
|
||||
return this.targetConnectionFactory;
|
||||
}
|
||||
|
||||
|
||||
@@ -29,8 +29,8 @@ import jakarta.jms.Session;
|
||||
import jakarta.jms.TransactionInProgressException;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.transaction.support.ResourceHolderSupport;
|
||||
import org.springframework.transaction.support.TransactionSynchronizationManager;
|
||||
import org.springframework.util.Assert;
|
||||
@@ -53,8 +53,7 @@ public class JmsResourceHolder extends ResourceHolderSupport {
|
||||
|
||||
private static final Log logger = LogFactory.getLog(JmsResourceHolder.class);
|
||||
|
||||
@Nullable
|
||||
private ConnectionFactory connectionFactory;
|
||||
private @Nullable ConnectionFactory connectionFactory;
|
||||
|
||||
private boolean frozen = false;
|
||||
|
||||
@@ -175,8 +174,7 @@ public class JmsResourceHolder extends ResourceHolderSupport {
|
||||
* Return this resource holder's default Connection,
|
||||
* or {@code null} if none.
|
||||
*/
|
||||
@Nullable
|
||||
public Connection getConnection() {
|
||||
public @Nullable Connection getConnection() {
|
||||
return this.connections.peek();
|
||||
}
|
||||
|
||||
@@ -184,8 +182,7 @@ public class JmsResourceHolder extends ResourceHolderSupport {
|
||||
* Return this resource holder's Connection of the given type,
|
||||
* or {@code null} if none.
|
||||
*/
|
||||
@Nullable
|
||||
public <C extends Connection> C getConnection(Class<C> connectionType) {
|
||||
public <C extends Connection> @Nullable C getConnection(Class<C> connectionType) {
|
||||
return CollectionUtils.findValueOfType(this.connections, connectionType);
|
||||
}
|
||||
|
||||
@@ -194,8 +191,7 @@ public class JmsResourceHolder extends ResourceHolderSupport {
|
||||
* <p>In contrast to {@link #getSession()}, this must not lazily initialize
|
||||
* a new Session, not even in {@link JmsResourceHolder} subclasses.
|
||||
*/
|
||||
@Nullable
|
||||
Session getOriginalSession() {
|
||||
@Nullable Session getOriginalSession() {
|
||||
return this.sessions.peek();
|
||||
}
|
||||
|
||||
@@ -203,8 +199,7 @@ public class JmsResourceHolder extends ResourceHolderSupport {
|
||||
* Return this resource holder's default Session,
|
||||
* or {@code null} if none.
|
||||
*/
|
||||
@Nullable
|
||||
public Session getSession() {
|
||||
public @Nullable Session getSession() {
|
||||
return this.sessions.peek();
|
||||
}
|
||||
|
||||
@@ -212,8 +207,7 @@ public class JmsResourceHolder extends ResourceHolderSupport {
|
||||
* Return this resource holder's Session of the given type,
|
||||
* or {@code null} if none.
|
||||
*/
|
||||
@Nullable
|
||||
public <S extends Session> S getSession(Class<S> sessionType) {
|
||||
public <S extends Session> @Nullable S getSession(Class<S> sessionType) {
|
||||
return getSession(sessionType, null);
|
||||
}
|
||||
|
||||
@@ -221,9 +215,8 @@ public class JmsResourceHolder extends ResourceHolderSupport {
|
||||
* Return this resource holder's Session of the given type
|
||||
* for the given connection, or {@code null} if none.
|
||||
*/
|
||||
@Nullable
|
||||
@SuppressWarnings("NullAway")
|
||||
public <S extends Session> S getSession(Class<S> sessionType, @Nullable Connection connection) {
|
||||
public <S extends Session> @Nullable S getSession(Class<S> sessionType, @Nullable Connection connection) {
|
||||
Deque<Session> sessions =
|
||||
(connection != null ? this.sessionsPerConnection.get(connection) : this.sessions);
|
||||
return CollectionUtils.findValueOfType(sessions, sessionType);
|
||||
|
||||
@@ -21,9 +21,9 @@ import jakarta.jms.ConnectionFactory;
|
||||
import jakarta.jms.JMSException;
|
||||
import jakarta.jms.Session;
|
||||
import jakarta.jms.TransactionRolledBackException;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
import org.springframework.beans.factory.InitializingBean;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.transaction.CannotCreateTransactionException;
|
||||
import org.springframework.transaction.InvalidIsolationLevelException;
|
||||
import org.springframework.transaction.TransactionDefinition;
|
||||
@@ -93,8 +93,7 @@ import org.springframework.util.Assert;
|
||||
public class JmsTransactionManager extends AbstractPlatformTransactionManager
|
||||
implements ResourceTransactionManager, InitializingBean {
|
||||
|
||||
@Nullable
|
||||
private ConnectionFactory connectionFactory;
|
||||
private @Nullable ConnectionFactory connectionFactory;
|
||||
|
||||
private boolean lazyResourceRetrieval = false;
|
||||
|
||||
@@ -144,8 +143,7 @@ public class JmsTransactionManager extends AbstractPlatformTransactionManager
|
||||
/**
|
||||
* Return the JMS ConnectionFactory that this instance should manage transactions for.
|
||||
*/
|
||||
@Nullable
|
||||
public ConnectionFactory getConnectionFactory() {
|
||||
public @Nullable ConnectionFactory getConnectionFactory() {
|
||||
return this.connectionFactory;
|
||||
}
|
||||
|
||||
@@ -357,36 +355,31 @@ public class JmsTransactionManager extends AbstractPlatformTransactionManager
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public Connection getConnection() {
|
||||
public @Nullable Connection getConnection() {
|
||||
initializeConnection();
|
||||
return super.getConnection();
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public <C extends Connection> C getConnection(Class<C> connectionType) {
|
||||
public <C extends Connection> @Nullable C getConnection(Class<C> connectionType) {
|
||||
initializeConnection();
|
||||
return super.getConnection(connectionType);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public Session getSession() {
|
||||
public @Nullable Session getSession() {
|
||||
initializeSession();
|
||||
return super.getSession();
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public <S extends Session> S getSession(Class<S> sessionType) {
|
||||
public <S extends Session> @Nullable S getSession(Class<S> sessionType) {
|
||||
initializeSession();
|
||||
return super.getSession(sessionType);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public <S extends Session> S getSession(Class<S> sessionType, @Nullable Connection connection) {
|
||||
public <S extends Session> @Nullable S getSession(Class<S> sessionType, @Nullable Connection connection) {
|
||||
initializeSession();
|
||||
return super.getSession(sessionType, connection);
|
||||
}
|
||||
@@ -428,8 +421,7 @@ public class JmsTransactionManager extends AbstractPlatformTransactionManager
|
||||
*/
|
||||
private static class JmsTransactionObject implements SmartTransactionObject {
|
||||
|
||||
@Nullable
|
||||
private JmsResourceHolder resourceHolder;
|
||||
private @Nullable JmsResourceHolder resourceHolder;
|
||||
|
||||
public void setResourceHolder(@Nullable JmsResourceHolder resourceHolder) {
|
||||
this.resourceHolder = resourceHolder;
|
||||
|
||||
@@ -39,11 +39,11 @@ import jakarta.jms.TopicConnection;
|
||||
import jakarta.jms.TopicConnectionFactory;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
import org.springframework.beans.factory.DisposableBean;
|
||||
import org.springframework.beans.factory.InitializingBean;
|
||||
import org.springframework.context.Lifecycle;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.ClassUtils;
|
||||
import org.springframework.util.ObjectUtils;
|
||||
@@ -92,28 +92,22 @@ public class SingleConnectionFactory implements ConnectionFactory, QueueConnecti
|
||||
|
||||
protected final Log logger = LogFactory.getLog(getClass());
|
||||
|
||||
@Nullable
|
||||
private ConnectionFactory targetConnectionFactory;
|
||||
private @Nullable ConnectionFactory targetConnectionFactory;
|
||||
|
||||
@Nullable
|
||||
private String clientId;
|
||||
private @Nullable String clientId;
|
||||
|
||||
@Nullable
|
||||
private ExceptionListener exceptionListener;
|
||||
private @Nullable ExceptionListener exceptionListener;
|
||||
|
||||
private boolean reconnectOnException = false;
|
||||
|
||||
/** The target Connection. */
|
||||
@Nullable
|
||||
private Connection connection;
|
||||
private @Nullable Connection connection;
|
||||
|
||||
/** A hint whether to create a queue or topic connection. */
|
||||
@Nullable
|
||||
private Boolean pubSubMode;
|
||||
private @Nullable Boolean pubSubMode;
|
||||
|
||||
/** An internal aggregator allowing for per-connection ExceptionListeners. */
|
||||
@Nullable
|
||||
private AggregatedExceptionListener aggregatedExceptionListener;
|
||||
private @Nullable AggregatedExceptionListener aggregatedExceptionListener;
|
||||
|
||||
/** Whether the shared Connection has been started. */
|
||||
private int startedCount = 0;
|
||||
@@ -161,8 +155,7 @@ public class SingleConnectionFactory implements ConnectionFactory, QueueConnecti
|
||||
* Return the target ConnectionFactory which will be used to lazily
|
||||
* create a single Connection, if any.
|
||||
*/
|
||||
@Nullable
|
||||
public ConnectionFactory getTargetConnectionFactory() {
|
||||
public @Nullable ConnectionFactory getTargetConnectionFactory() {
|
||||
return this.targetConnectionFactory;
|
||||
}
|
||||
|
||||
@@ -183,8 +176,7 @@ public class SingleConnectionFactory implements ConnectionFactory, QueueConnecti
|
||||
* Return a JMS client ID for the single Connection created and exposed
|
||||
* by this ConnectionFactory, if any.
|
||||
*/
|
||||
@Nullable
|
||||
protected String getClientId() {
|
||||
protected @Nullable String getClientId() {
|
||||
return this.clientId;
|
||||
}
|
||||
|
||||
@@ -201,8 +193,7 @@ public class SingleConnectionFactory implements ConnectionFactory, QueueConnecti
|
||||
* Return the JMS ExceptionListener implementation that should be registered
|
||||
* with the single Connection created by this factory, if any.
|
||||
*/
|
||||
@Nullable
|
||||
protected ExceptionListener getExceptionListener() {
|
||||
protected @Nullable ExceptionListener getExceptionListener() {
|
||||
return this.exceptionListener;
|
||||
}
|
||||
|
||||
@@ -519,8 +510,7 @@ public class SingleConnectionFactory implements ConnectionFactory, QueueConnecti
|
||||
* creation of a raw standard Session
|
||||
* @throws JMSException if thrown by the JMS API
|
||||
*/
|
||||
@Nullable
|
||||
protected Session getSession(Connection con, Integer mode) throws JMSException {
|
||||
protected @Nullable Session getSession(Connection con, Integer mode) throws JMSException {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -616,14 +606,12 @@ public class SingleConnectionFactory implements ConnectionFactory, QueueConnecti
|
||||
*/
|
||||
private class SharedConnectionInvocationHandler implements InvocationHandler {
|
||||
|
||||
@Nullable
|
||||
private ExceptionListener localExceptionListener;
|
||||
private @Nullable ExceptionListener localExceptionListener;
|
||||
|
||||
private boolean locallyStarted = false;
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
|
||||
public @Nullable Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
|
||||
switch (method.getName()) {
|
||||
case "equals" -> {
|
||||
Object other = args[0];
|
||||
|
||||
@@ -35,8 +35,8 @@ import jakarta.jms.TopicConnection;
|
||||
import jakarta.jms.TopicConnectionFactory;
|
||||
import jakarta.jms.TopicSession;
|
||||
import jakarta.jms.TransactionInProgressException;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.ClassUtils;
|
||||
|
||||
@@ -86,8 +86,7 @@ import org.springframework.util.ClassUtils;
|
||||
public class TransactionAwareConnectionFactoryProxy
|
||||
implements ConnectionFactory, QueueConnectionFactory, TopicConnectionFactory {
|
||||
|
||||
@Nullable
|
||||
private ConnectionFactory targetConnectionFactory;
|
||||
private @Nullable ConnectionFactory targetConnectionFactory;
|
||||
|
||||
private boolean synchedLocalTransactionAllowed = false;
|
||||
|
||||
@@ -327,8 +326,7 @@ public class TransactionAwareConnectionFactoryProxy
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
|
||||
public @Nullable Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
|
||||
// Invocation on SessionProxy interface coming in...
|
||||
|
||||
return switch (method.getName()) {
|
||||
|
||||
@@ -24,10 +24,10 @@ import jakarta.jms.QueueConnection;
|
||||
import jakarta.jms.QueueConnectionFactory;
|
||||
import jakarta.jms.TopicConnection;
|
||||
import jakarta.jms.TopicConnectionFactory;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
import org.springframework.beans.factory.InitializingBean;
|
||||
import org.springframework.core.NamedThreadLocal;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
@@ -81,14 +81,11 @@ import org.springframework.util.StringUtils;
|
||||
public class UserCredentialsConnectionFactoryAdapter
|
||||
implements ConnectionFactory, QueueConnectionFactory, TopicConnectionFactory, InitializingBean {
|
||||
|
||||
@Nullable
|
||||
private ConnectionFactory targetConnectionFactory;
|
||||
private @Nullable ConnectionFactory targetConnectionFactory;
|
||||
|
||||
@Nullable
|
||||
private String username;
|
||||
private @Nullable String username;
|
||||
|
||||
@Nullable
|
||||
private String password;
|
||||
private @Nullable String password;
|
||||
|
||||
private final ThreadLocal<JmsUserCredentials> threadBoundCredentials =
|
||||
new NamedThreadLocal<>("Current JMS user credentials");
|
||||
|
||||
@@ -2,9 +2,7 @@
|
||||
* Provides a PlatformTransactionManager implementation for a single
|
||||
* JMS ConnectionFactory, and a SingleConnectionFactory adapter.
|
||||
*/
|
||||
@NonNullApi
|
||||
@NonNullFields
|
||||
@NullMarked
|
||||
package org.springframework.jms.connection;
|
||||
|
||||
import org.springframework.lang.NonNullApi;
|
||||
import org.springframework.lang.NonNullFields;
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
|
||||
@@ -19,8 +19,7 @@ package org.springframework.jms.core;
|
||||
import jakarta.jms.JMSException;
|
||||
import jakarta.jms.QueueBrowser;
|
||||
import jakarta.jms.Session;
|
||||
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
/**
|
||||
* Callback for browsing the messages in a JMS queue.
|
||||
@@ -47,7 +46,6 @@ public interface BrowserCallback<T> {
|
||||
* (or {@code null} if none)
|
||||
* @throws jakarta.jms.JMSException if thrown by JMS API methods
|
||||
*/
|
||||
@Nullable
|
||||
T doInJms(Session session, QueueBrowser browser) throws JMSException;
|
||||
@Nullable T doInJms(Session session, QueueBrowser browser) throws JMSException;
|
||||
|
||||
}
|
||||
|
||||
@@ -19,8 +19,8 @@ package org.springframework.jms.core;
|
||||
import java.util.Map;
|
||||
|
||||
import jakarta.jms.Destination;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.messaging.Message;
|
||||
import org.springframework.messaging.MessagingException;
|
||||
import org.springframework.messaging.core.MessagePostProcessor;
|
||||
@@ -102,8 +102,7 @@ public interface JmsMessageOperations extends MessageSendingOperations<Destinati
|
||||
* @return the received message, possibly {@code null} if the message could not
|
||||
* be received, for example due to a timeout
|
||||
*/
|
||||
@Nullable
|
||||
Message<?> receive(String destinationName) throws MessagingException;
|
||||
@Nullable Message<?> receive(String destinationName) throws MessagingException;
|
||||
|
||||
/**
|
||||
* Receive a message from the given destination and convert its payload to the
|
||||
@@ -113,8 +112,7 @@ public interface JmsMessageOperations extends MessageSendingOperations<Destinati
|
||||
* @return the converted payload of the reply message, possibly {@code null} if
|
||||
* the message could not be received, for example due to a timeout
|
||||
*/
|
||||
@Nullable
|
||||
<T> T receiveAndConvert(String destinationName, Class<T> targetClass) throws MessagingException;
|
||||
<T> @Nullable T receiveAndConvert(String destinationName, Class<T> targetClass) throws MessagingException;
|
||||
|
||||
/**
|
||||
* Send a request message and receive the reply from the given destination.
|
||||
@@ -123,8 +121,7 @@ public interface JmsMessageOperations extends MessageSendingOperations<Destinati
|
||||
* @return the reply, possibly {@code null} if the message could not be received,
|
||||
* for example due to a timeout
|
||||
*/
|
||||
@Nullable
|
||||
Message<?> sendAndReceive(String destinationName, Message<?> requestMessage) throws MessagingException;
|
||||
@Nullable Message<?> sendAndReceive(String destinationName, Message<?> requestMessage) throws MessagingException;
|
||||
|
||||
/**
|
||||
* Convert the given request Object to serialized form, possibly using a
|
||||
@@ -137,8 +134,7 @@ public interface JmsMessageOperations extends MessageSendingOperations<Destinati
|
||||
* @return the payload of the reply message, possibly {@code null} if the message
|
||||
* could not be received, for example due to a timeout
|
||||
*/
|
||||
@Nullable
|
||||
<T> T convertSendAndReceive(String destinationName, Object request, Class<T> targetClass) throws MessagingException;
|
||||
<T> @Nullable T convertSendAndReceive(String destinationName, Object request, Class<T> targetClass) throws MessagingException;
|
||||
|
||||
/**
|
||||
* Convert the given request Object to serialized form, possibly using a
|
||||
@@ -152,8 +148,7 @@ public interface JmsMessageOperations extends MessageSendingOperations<Destinati
|
||||
* @return the payload of the reply message, possibly {@code null} if the message
|
||||
* could not be received, for example due to a timeout
|
||||
*/
|
||||
@Nullable
|
||||
<T> T convertSendAndReceive(String destinationName, Object request, @Nullable Map<String, Object> headers, Class<T> targetClass)
|
||||
<T> @Nullable T convertSendAndReceive(String destinationName, Object request, @Nullable Map<String, Object> headers, Class<T> targetClass)
|
||||
throws MessagingException;
|
||||
|
||||
/**
|
||||
@@ -169,8 +164,7 @@ public interface JmsMessageOperations extends MessageSendingOperations<Destinati
|
||||
* @return the payload of the reply message, possibly {@code null} if the message
|
||||
* could not be received, for example due to a timeout
|
||||
*/
|
||||
@Nullable
|
||||
<T> T convertSendAndReceive(String destinationName, Object request, Class<T> targetClass,
|
||||
<T> @Nullable T convertSendAndReceive(String destinationName, Object request, Class<T> targetClass,
|
||||
MessagePostProcessor requestPostProcessor) throws MessagingException;
|
||||
|
||||
/**
|
||||
@@ -186,8 +180,7 @@ public interface JmsMessageOperations extends MessageSendingOperations<Destinati
|
||||
* @return the payload of the reply message, possibly {@code null} if the message
|
||||
* could not be received, for example due to a timeout
|
||||
*/
|
||||
@Nullable
|
||||
<T> T convertSendAndReceive(String destinationName, Object request, Map<String, Object> headers,
|
||||
<T> @Nullable T convertSendAndReceive(String destinationName, Object request, Map<String, Object> headers,
|
||||
Class<T> targetClass, MessagePostProcessor requestPostProcessor) throws MessagingException;
|
||||
|
||||
}
|
||||
|
||||
@@ -22,6 +22,7 @@ import jakarta.jms.ConnectionFactory;
|
||||
import jakarta.jms.Destination;
|
||||
import jakarta.jms.JMSException;
|
||||
import jakarta.jms.Session;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
import org.springframework.beans.factory.InitializingBean;
|
||||
import org.springframework.jms.InvalidDestinationException;
|
||||
@@ -29,7 +30,6 @@ import org.springframework.jms.JmsException;
|
||||
import org.springframework.jms.support.converter.MessageConverter;
|
||||
import org.springframework.jms.support.converter.MessagingMessageConverter;
|
||||
import org.springframework.jms.support.converter.SimpleMessageConverter;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.messaging.Message;
|
||||
import org.springframework.messaging.MessagingException;
|
||||
import org.springframework.messaging.converter.MessageConversionException;
|
||||
@@ -48,15 +48,13 @@ import org.springframework.util.Assert;
|
||||
public class JmsMessagingTemplate extends AbstractMessagingTemplate<Destination>
|
||||
implements JmsMessageOperations, InitializingBean {
|
||||
|
||||
@Nullable
|
||||
private JmsTemplate jmsTemplate;
|
||||
private @Nullable JmsTemplate jmsTemplate;
|
||||
|
||||
private MessageConverter jmsMessageConverter = new MessagingMessageConverter();
|
||||
|
||||
private boolean converterSet;
|
||||
|
||||
@Nullable
|
||||
private String defaultDestinationName;
|
||||
private @Nullable String defaultDestinationName;
|
||||
|
||||
|
||||
/**
|
||||
@@ -101,8 +99,7 @@ public class JmsMessagingTemplate extends AbstractMessagingTemplate<Destination>
|
||||
* Return the ConnectionFactory that the underlying {@link JmsTemplate} uses.
|
||||
* @since 4.1.2
|
||||
*/
|
||||
@Nullable
|
||||
public ConnectionFactory getConnectionFactory() {
|
||||
public @Nullable ConnectionFactory getConnectionFactory() {
|
||||
return (this.jmsTemplate != null ? this.jmsTemplate.getConnectionFactory() : null);
|
||||
}
|
||||
|
||||
@@ -116,8 +113,7 @@ public class JmsMessagingTemplate extends AbstractMessagingTemplate<Destination>
|
||||
/**
|
||||
* Return the configured {@link JmsTemplate}.
|
||||
*/
|
||||
@Nullable
|
||||
public JmsTemplate getJmsTemplate() {
|
||||
public @Nullable JmsTemplate getJmsTemplate() {
|
||||
return this.jmsTemplate;
|
||||
}
|
||||
|
||||
@@ -158,8 +154,7 @@ public class JmsMessagingTemplate extends AbstractMessagingTemplate<Destination>
|
||||
/**
|
||||
* Return the configured default destination name.
|
||||
*/
|
||||
@Nullable
|
||||
public String getDefaultDestinationName() {
|
||||
public @Nullable String getDefaultDestinationName() {
|
||||
return this.defaultDestinationName;
|
||||
}
|
||||
|
||||
@@ -233,8 +228,7 @@ public class JmsMessagingTemplate extends AbstractMessagingTemplate<Destination>
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public Message<?> receive() {
|
||||
public @Nullable Message<?> receive() {
|
||||
Destination defaultDestination = getDefaultDestination();
|
||||
if (defaultDestination != null) {
|
||||
return receive(defaultDestination);
|
||||
@@ -245,8 +239,7 @@ public class JmsMessagingTemplate extends AbstractMessagingTemplate<Destination>
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public <T> T receiveAndConvert(Class<T> targetClass) {
|
||||
public <T> @Nullable T receiveAndConvert(Class<T> targetClass) {
|
||||
Destination defaultDestination = getDefaultDestination();
|
||||
if (defaultDestination != null) {
|
||||
return receiveAndConvert(defaultDestination, targetClass);
|
||||
@@ -257,14 +250,12 @@ public class JmsMessagingTemplate extends AbstractMessagingTemplate<Destination>
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public Message<?> receive(String destinationName) throws MessagingException {
|
||||
public @Nullable Message<?> receive(String destinationName) throws MessagingException {
|
||||
return doReceive(destinationName);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public <T> T receiveAndConvert(String destinationName, Class<T> targetClass) throws MessagingException {
|
||||
public <T> @Nullable T receiveAndConvert(String destinationName, Class<T> targetClass) throws MessagingException {
|
||||
Message<?> message = doReceive(destinationName);
|
||||
if (message != null) {
|
||||
return doConvert(message, targetClass);
|
||||
@@ -275,8 +266,7 @@ public class JmsMessagingTemplate extends AbstractMessagingTemplate<Destination>
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public Message<?> sendAndReceive(Message<?> requestMessage) {
|
||||
public @Nullable Message<?> sendAndReceive(Message<?> requestMessage) {
|
||||
Destination defaultDestination = getDefaultDestination();
|
||||
if (defaultDestination != null) {
|
||||
return sendAndReceive(defaultDestination, requestMessage);
|
||||
@@ -287,36 +277,31 @@ public class JmsMessagingTemplate extends AbstractMessagingTemplate<Destination>
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public Message<?> sendAndReceive(String destinationName, Message<?> requestMessage) throws MessagingException {
|
||||
public @Nullable Message<?> sendAndReceive(String destinationName, Message<?> requestMessage) throws MessagingException {
|
||||
return doSendAndReceive(destinationName, requestMessage);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public <T> T convertSendAndReceive(String destinationName, Object request, Class<T> targetClass)
|
||||
public <T> @Nullable T convertSendAndReceive(String destinationName, Object request, Class<T> targetClass)
|
||||
throws MessagingException {
|
||||
|
||||
return convertSendAndReceive(destinationName, request, null, targetClass);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public <T> T convertSendAndReceive(Object request, Class<T> targetClass) {
|
||||
public <T> @Nullable T convertSendAndReceive(Object request, Class<T> targetClass) {
|
||||
return convertSendAndReceive(request, targetClass, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public <T> T convertSendAndReceive(String destinationName, Object request,
|
||||
public <T> @Nullable T convertSendAndReceive(String destinationName, Object request,
|
||||
@Nullable Map<String, Object> headers, Class<T> targetClass) throws MessagingException {
|
||||
|
||||
return convertSendAndReceive(destinationName, request, headers, targetClass, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public <T> T convertSendAndReceive(Object request, Class<T> targetClass, @Nullable MessagePostProcessor postProcessor) {
|
||||
public <T> @Nullable T convertSendAndReceive(Object request, Class<T> targetClass, @Nullable MessagePostProcessor postProcessor) {
|
||||
Destination defaultDestination = getDefaultDestination();
|
||||
if (defaultDestination != null) {
|
||||
return convertSendAndReceive(defaultDestination, request, targetClass, postProcessor);
|
||||
@@ -327,8 +312,7 @@ public class JmsMessagingTemplate extends AbstractMessagingTemplate<Destination>
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public <T> T convertSendAndReceive(String destinationName, Object request, Class<T> targetClass,
|
||||
public <T> @Nullable T convertSendAndReceive(String destinationName, Object request, Class<T> targetClass,
|
||||
@Nullable MessagePostProcessor requestPostProcessor) throws MessagingException {
|
||||
|
||||
return convertSendAndReceive(destinationName, request, null, targetClass, requestPostProcessor);
|
||||
@@ -336,8 +320,7 @@ public class JmsMessagingTemplate extends AbstractMessagingTemplate<Destination>
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
@Nullable
|
||||
public <T> T convertSendAndReceive(String destinationName, Object request, @Nullable Map<String, Object> headers,
|
||||
public <T> @Nullable T convertSendAndReceive(String destinationName, Object request, @Nullable Map<String, Object> headers,
|
||||
Class<T> targetClass, @Nullable MessagePostProcessor postProcessor) {
|
||||
|
||||
Message<?> requestMessage = doConvert(request, headers, postProcessor);
|
||||
@@ -365,8 +348,7 @@ public class JmsMessagingTemplate extends AbstractMessagingTemplate<Destination>
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
protected Message<?> doReceive(Destination destination) {
|
||||
protected @Nullable Message<?> doReceive(Destination destination) {
|
||||
try {
|
||||
jakarta.jms.Message jmsMessage = obtainJmsTemplate().receive(destination);
|
||||
return convertJmsMessage(jmsMessage);
|
||||
@@ -376,8 +358,7 @@ public class JmsMessagingTemplate extends AbstractMessagingTemplate<Destination>
|
||||
}
|
||||
}
|
||||
|
||||
@Nullable
|
||||
protected Message<?> doReceive(String destinationName) {
|
||||
protected @Nullable Message<?> doReceive(String destinationName) {
|
||||
try {
|
||||
jakarta.jms.Message jmsMessage = obtainJmsTemplate().receive(destinationName);
|
||||
return convertJmsMessage(jmsMessage);
|
||||
@@ -388,8 +369,7 @@ public class JmsMessagingTemplate extends AbstractMessagingTemplate<Destination>
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
protected Message<?> doSendAndReceive(Destination destination, Message<?> requestMessage) {
|
||||
protected @Nullable Message<?> doSendAndReceive(Destination destination, Message<?> requestMessage) {
|
||||
try {
|
||||
jakarta.jms.Message jmsMessage = obtainJmsTemplate().sendAndReceive(
|
||||
destination, createMessageCreator(requestMessage));
|
||||
@@ -400,8 +380,7 @@ public class JmsMessagingTemplate extends AbstractMessagingTemplate<Destination>
|
||||
}
|
||||
}
|
||||
|
||||
@Nullable
|
||||
protected Message<?> doSendAndReceive(String destinationName, Message<?> requestMessage) {
|
||||
protected @Nullable Message<?> doSendAndReceive(String destinationName, Message<?> requestMessage) {
|
||||
try {
|
||||
jakarta.jms.Message jmsMessage = obtainJmsTemplate().sendAndReceive(
|
||||
destinationName, createMessageCreator(requestMessage));
|
||||
@@ -425,8 +404,7 @@ public class JmsMessagingTemplate extends AbstractMessagingTemplate<Destination>
|
||||
return name;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
protected Message<?> convertJmsMessage(@Nullable jakarta.jms.Message message) {
|
||||
protected @Nullable Message<?> convertJmsMessage(jakarta.jms.@Nullable Message message) {
|
||||
if (message == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -19,9 +19,9 @@ package org.springframework.jms.core;
|
||||
import jakarta.jms.Destination;
|
||||
import jakarta.jms.Message;
|
||||
import jakarta.jms.Queue;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
import org.springframework.jms.JmsException;
|
||||
import org.springframework.lang.Nullable;
|
||||
|
||||
/**
|
||||
* Specifies a basic set of JMS operations.
|
||||
@@ -54,8 +54,7 @@ public interface JmsOperations {
|
||||
* @return the result object from working with the session
|
||||
* @throws JmsException if there is any problem
|
||||
*/
|
||||
@Nullable
|
||||
<T> T execute(SessionCallback<T> action) throws JmsException;
|
||||
<T> @Nullable T execute(SessionCallback<T> action) throws JmsException;
|
||||
|
||||
/**
|
||||
* Send messages to the default JMS destination (or one specified
|
||||
@@ -65,8 +64,7 @@ public interface JmsOperations {
|
||||
* @return the result object from working with the session
|
||||
* @throws JmsException checked JMSException converted to unchecked
|
||||
*/
|
||||
@Nullable
|
||||
<T> T execute(ProducerCallback<T> action) throws JmsException;
|
||||
<T> @Nullable T execute(ProducerCallback<T> action) throws JmsException;
|
||||
|
||||
/**
|
||||
* Send messages to a JMS destination. The callback gives access to the JMS Session
|
||||
@@ -76,8 +74,7 @@ public interface JmsOperations {
|
||||
* @return the result object from working with the session
|
||||
* @throws JmsException checked JMSException converted to unchecked
|
||||
*/
|
||||
@Nullable
|
||||
<T> T execute(Destination destination, ProducerCallback<T> action) throws JmsException;
|
||||
<T> @Nullable T execute(Destination destination, ProducerCallback<T> action) throws JmsException;
|
||||
|
||||
/**
|
||||
* Send messages to a JMS destination. The callback gives access to the JMS Session
|
||||
@@ -88,8 +85,7 @@ public interface JmsOperations {
|
||||
* @return the result object from working with the session
|
||||
* @throws JmsException checked JMSException converted to unchecked
|
||||
*/
|
||||
@Nullable
|
||||
<T> T execute(String destinationName, ProducerCallback<T> action) throws JmsException;
|
||||
<T> @Nullable T execute(String destinationName, ProducerCallback<T> action) throws JmsException;
|
||||
|
||||
|
||||
//---------------------------------------------------------------------------------------
|
||||
@@ -207,8 +203,7 @@ public interface JmsOperations {
|
||||
* @return the message received by the consumer, or {@code null} if the timeout expires
|
||||
* @throws JmsException checked JMSException converted to unchecked
|
||||
*/
|
||||
@Nullable
|
||||
Message receive() throws JmsException;
|
||||
@Nullable Message receive() throws JmsException;
|
||||
|
||||
/**
|
||||
* Receive a message synchronously from the specified destination, but only
|
||||
@@ -219,8 +214,7 @@ public interface JmsOperations {
|
||||
* @return the message received by the consumer, or {@code null} if the timeout expires
|
||||
* @throws JmsException checked JMSException converted to unchecked
|
||||
*/
|
||||
@Nullable
|
||||
Message receive(Destination destination) throws JmsException;
|
||||
@Nullable Message receive(Destination destination) throws JmsException;
|
||||
|
||||
/**
|
||||
* Receive a message synchronously from the specified destination, but only
|
||||
@@ -232,8 +226,7 @@ public interface JmsOperations {
|
||||
* @return the message received by the consumer, or {@code null} if the timeout expires
|
||||
* @throws JmsException checked JMSException converted to unchecked
|
||||
*/
|
||||
@Nullable
|
||||
Message receive(String destinationName) throws JmsException;
|
||||
@Nullable Message receive(String destinationName) throws JmsException;
|
||||
|
||||
/**
|
||||
* Receive a message synchronously from the default destination, but only
|
||||
@@ -246,8 +239,7 @@ public interface JmsOperations {
|
||||
* @return the message received by the consumer, or {@code null} if the timeout expires
|
||||
* @throws JmsException checked JMSException converted to unchecked
|
||||
*/
|
||||
@Nullable
|
||||
Message receiveSelected(String messageSelector) throws JmsException;
|
||||
@Nullable Message receiveSelected(String messageSelector) throws JmsException;
|
||||
|
||||
/**
|
||||
* Receive a message synchronously from the specified destination, but only
|
||||
@@ -260,8 +252,7 @@ public interface JmsOperations {
|
||||
* @return the message received by the consumer, or {@code null} if the timeout expires
|
||||
* @throws JmsException checked JMSException converted to unchecked
|
||||
*/
|
||||
@Nullable
|
||||
Message receiveSelected(Destination destination, String messageSelector) throws JmsException;
|
||||
@Nullable Message receiveSelected(Destination destination, String messageSelector) throws JmsException;
|
||||
|
||||
/**
|
||||
* Receive a message synchronously from the specified destination, but only
|
||||
@@ -275,8 +266,7 @@ public interface JmsOperations {
|
||||
* @return the message received by the consumer, or {@code null} if the timeout expires
|
||||
* @throws JmsException checked JMSException converted to unchecked
|
||||
*/
|
||||
@Nullable
|
||||
Message receiveSelected(String destinationName, String messageSelector) throws JmsException;
|
||||
@Nullable Message receiveSelected(String destinationName, String messageSelector) throws JmsException;
|
||||
|
||||
|
||||
//---------------------------------------------------------------------------------------
|
||||
@@ -293,8 +283,7 @@ public interface JmsOperations {
|
||||
* @return the message produced for the consumer, or {@code null} if the timeout expires
|
||||
* @throws JmsException checked JMSException converted to unchecked
|
||||
*/
|
||||
@Nullable
|
||||
Object receiveAndConvert() throws JmsException;
|
||||
@Nullable Object receiveAndConvert() throws JmsException;
|
||||
|
||||
/**
|
||||
* Receive a message synchronously from the specified destination, but only
|
||||
@@ -306,8 +295,7 @@ public interface JmsOperations {
|
||||
* @return the message produced for the consumer, or {@code null} if the timeout expires
|
||||
* @throws JmsException checked JMSException converted to unchecked
|
||||
*/
|
||||
@Nullable
|
||||
Object receiveAndConvert(Destination destination) throws JmsException;
|
||||
@Nullable Object receiveAndConvert(Destination destination) throws JmsException;
|
||||
|
||||
/**
|
||||
* Receive a message synchronously from the specified destination, but only
|
||||
@@ -320,8 +308,7 @@ public interface JmsOperations {
|
||||
* @return the message produced for the consumer, or {@code null} if the timeout expires
|
||||
* @throws JmsException checked JMSException converted to unchecked
|
||||
*/
|
||||
@Nullable
|
||||
Object receiveAndConvert(String destinationName) throws JmsException;
|
||||
@Nullable Object receiveAndConvert(String destinationName) throws JmsException;
|
||||
|
||||
/**
|
||||
* Receive a message synchronously from the default destination, but only
|
||||
@@ -335,8 +322,7 @@ public interface JmsOperations {
|
||||
* @return the message produced for the consumer, or {@code null} if the timeout expires
|
||||
* @throws JmsException checked JMSException converted to unchecked
|
||||
*/
|
||||
@Nullable
|
||||
Object receiveSelectedAndConvert(String messageSelector) throws JmsException;
|
||||
@Nullable Object receiveSelectedAndConvert(String messageSelector) throws JmsException;
|
||||
|
||||
/**
|
||||
* Receive a message synchronously from the specified destination, but only
|
||||
@@ -350,8 +336,7 @@ public interface JmsOperations {
|
||||
* @return the message produced for the consumer, or {@code null} if the timeout expires
|
||||
* @throws JmsException checked JMSException converted to unchecked
|
||||
*/
|
||||
@Nullable
|
||||
Object receiveSelectedAndConvert(Destination destination, String messageSelector) throws JmsException;
|
||||
@Nullable Object receiveSelectedAndConvert(Destination destination, String messageSelector) throws JmsException;
|
||||
|
||||
/**
|
||||
* Receive a message synchronously from the specified destination, but only
|
||||
@@ -366,8 +351,7 @@ public interface JmsOperations {
|
||||
* @return the message produced for the consumer, or {@code null} if the timeout expires
|
||||
* @throws JmsException checked JMSException converted to unchecked
|
||||
*/
|
||||
@Nullable
|
||||
Object receiveSelectedAndConvert(String destinationName, String messageSelector) throws JmsException;
|
||||
@Nullable Object receiveSelectedAndConvert(String destinationName, String messageSelector) throws JmsException;
|
||||
|
||||
|
||||
//---------------------------------------------------------------------------------------
|
||||
@@ -386,8 +370,7 @@ public interface JmsOperations {
|
||||
* @throws JmsException checked JMSException converted to unchecked
|
||||
* @since 4.1
|
||||
*/
|
||||
@Nullable
|
||||
Message sendAndReceive(MessageCreator messageCreator) throws JmsException;
|
||||
@Nullable Message sendAndReceive(MessageCreator messageCreator) throws JmsException;
|
||||
|
||||
/**
|
||||
* Send a message and receive the reply from the specified destination. The
|
||||
@@ -401,8 +384,7 @@ public interface JmsOperations {
|
||||
* @throws JmsException checked JMSException converted to unchecked
|
||||
* @since 4.1
|
||||
*/
|
||||
@Nullable
|
||||
Message sendAndReceive(Destination destination, MessageCreator messageCreator) throws JmsException;
|
||||
@Nullable Message sendAndReceive(Destination destination, MessageCreator messageCreator) throws JmsException;
|
||||
|
||||
/**
|
||||
* Send a message and receive the reply from the specified destination. The
|
||||
@@ -417,8 +399,7 @@ public interface JmsOperations {
|
||||
* @throws JmsException checked JMSException converted to unchecked
|
||||
* @since 4.1
|
||||
*/
|
||||
@Nullable
|
||||
Message sendAndReceive(String destinationName, MessageCreator messageCreator) throws JmsException;
|
||||
@Nullable Message sendAndReceive(String destinationName, MessageCreator messageCreator) throws JmsException;
|
||||
|
||||
|
||||
//---------------------------------------------------------------------------------------
|
||||
@@ -432,8 +413,7 @@ public interface JmsOperations {
|
||||
* @return the result object from working with the session
|
||||
* @throws JmsException checked JMSException converted to unchecked
|
||||
*/
|
||||
@Nullable
|
||||
<T> T browse(BrowserCallback<T> action) throws JmsException;
|
||||
<T> @Nullable T browse(BrowserCallback<T> action) throws JmsException;
|
||||
|
||||
/**
|
||||
* Browse messages in a JMS queue. The callback gives access to the JMS Session
|
||||
@@ -443,8 +423,7 @@ public interface JmsOperations {
|
||||
* @return the result object from working with the session
|
||||
* @throws JmsException checked JMSException converted to unchecked
|
||||
*/
|
||||
@Nullable
|
||||
<T> T browse(Queue queue, BrowserCallback<T> action) throws JmsException;
|
||||
<T> @Nullable T browse(Queue queue, BrowserCallback<T> action) throws JmsException;
|
||||
|
||||
/**
|
||||
* Browse messages in a JMS queue. The callback gives access to the JMS Session
|
||||
@@ -455,8 +434,7 @@ public interface JmsOperations {
|
||||
* @return the result object from working with the session
|
||||
* @throws JmsException checked JMSException converted to unchecked
|
||||
*/
|
||||
@Nullable
|
||||
<T> T browse(String queueName, BrowserCallback<T> action) throws JmsException;
|
||||
<T> @Nullable T browse(String queueName, BrowserCallback<T> action) throws JmsException;
|
||||
|
||||
/**
|
||||
* Browse selected messages in a JMS queue. The callback gives access to the JMS
|
||||
@@ -467,8 +445,7 @@ public interface JmsOperations {
|
||||
* @return the result object from working with the session
|
||||
* @throws JmsException checked JMSException converted to unchecked
|
||||
*/
|
||||
@Nullable
|
||||
<T> T browseSelected(String messageSelector, BrowserCallback<T> action) throws JmsException;
|
||||
<T> @Nullable T browseSelected(String messageSelector, BrowserCallback<T> action) throws JmsException;
|
||||
|
||||
/**
|
||||
* Browse selected messages in a JMS queue. The callback gives access to the JMS
|
||||
@@ -480,8 +457,7 @@ public interface JmsOperations {
|
||||
* @return the result object from working with the session
|
||||
* @throws JmsException checked JMSException converted to unchecked
|
||||
*/
|
||||
@Nullable
|
||||
<T> T browseSelected(Queue queue, String messageSelector, BrowserCallback<T> action) throws JmsException;
|
||||
<T> @Nullable T browseSelected(Queue queue, String messageSelector, BrowserCallback<T> action) throws JmsException;
|
||||
|
||||
/**
|
||||
* Browse selected messages in a JMS queue. The callback gives access to the JMS
|
||||
@@ -494,7 +470,6 @@ public interface JmsOperations {
|
||||
* @return the result object from working with the session
|
||||
* @throws JmsException checked JMSException converted to unchecked
|
||||
*/
|
||||
@Nullable
|
||||
<T> T browseSelected(String queueName, String messageSelector, BrowserCallback<T> action) throws JmsException;
|
||||
<T> @Nullable T browseSelected(String queueName, String messageSelector, BrowserCallback<T> action) throws JmsException;
|
||||
|
||||
}
|
||||
|
||||
@@ -30,6 +30,7 @@ import jakarta.jms.Queue;
|
||||
import jakarta.jms.QueueBrowser;
|
||||
import jakarta.jms.Session;
|
||||
import jakarta.jms.TemporaryQueue;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
import org.springframework.jms.JmsException;
|
||||
import org.springframework.jms.connection.ConnectionFactoryUtils;
|
||||
@@ -39,7 +40,6 @@ import org.springframework.jms.support.QosSettings;
|
||||
import org.springframework.jms.support.converter.MessageConverter;
|
||||
import org.springframework.jms.support.converter.SimpleMessageConverter;
|
||||
import org.springframework.jms.support.destination.JmsDestinationAccessor;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.transaction.support.TransactionSynchronizationManager;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.ClassUtils;
|
||||
@@ -99,11 +99,9 @@ public class JmsTemplate extends JmsDestinationAccessor implements JmsOperations
|
||||
private final JmsTemplateResourceFactory transactionalResourceFactory = new JmsTemplateResourceFactory();
|
||||
|
||||
|
||||
@Nullable
|
||||
private Object defaultDestination;
|
||||
private @Nullable Object defaultDestination;
|
||||
|
||||
@Nullable
|
||||
private MessageConverter messageConverter;
|
||||
private @Nullable MessageConverter messageConverter;
|
||||
|
||||
|
||||
private boolean messageIdEnabled = true;
|
||||
@@ -125,8 +123,7 @@ public class JmsTemplate extends JmsDestinationAccessor implements JmsOperations
|
||||
|
||||
private long timeToLive = Message.DEFAULT_TIME_TO_LIVE;
|
||||
|
||||
@Nullable
|
||||
private ObservationRegistry observationRegistry;
|
||||
private @Nullable ObservationRegistry observationRegistry;
|
||||
|
||||
|
||||
/**
|
||||
@@ -181,13 +178,11 @@ public class JmsTemplate extends JmsDestinationAccessor implements JmsOperations
|
||||
* Return the destination to be used on send/receive operations that do not
|
||||
* have a destination parameter.
|
||||
*/
|
||||
@Nullable
|
||||
public Destination getDefaultDestination() {
|
||||
public @Nullable Destination getDefaultDestination() {
|
||||
return (this.defaultDestination instanceof Destination dest ? dest : null);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private Queue getDefaultQueue() {
|
||||
private @Nullable Queue getDefaultQueue() {
|
||||
Destination defaultDestination = getDefaultDestination();
|
||||
if (defaultDestination == null) {
|
||||
return null;
|
||||
@@ -218,8 +213,7 @@ public class JmsTemplate extends JmsDestinationAccessor implements JmsOperations
|
||||
* Return the destination name to be used on send/receive operations that
|
||||
* do not have a destination parameter.
|
||||
*/
|
||||
@Nullable
|
||||
public String getDefaultDestinationName() {
|
||||
public @Nullable String getDefaultDestinationName() {
|
||||
return (this.defaultDestination instanceof String name ? name : null);
|
||||
}
|
||||
|
||||
@@ -249,8 +243,7 @@ public class JmsTemplate extends JmsDestinationAccessor implements JmsOperations
|
||||
/**
|
||||
* Return the message converter for this template.
|
||||
*/
|
||||
@Nullable
|
||||
public MessageConverter getMessageConverter() {
|
||||
public @Nullable MessageConverter getMessageConverter() {
|
||||
return this.messageConverter;
|
||||
}
|
||||
|
||||
@@ -485,8 +478,7 @@ public class JmsTemplate extends JmsDestinationAccessor implements JmsOperations
|
||||
//---------------------------------------------------------------------------------------
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public <T> T execute(SessionCallback<T> action) throws JmsException {
|
||||
public <T> @Nullable T execute(SessionCallback<T> action) throws JmsException {
|
||||
return execute(action, false);
|
||||
}
|
||||
|
||||
@@ -505,8 +497,7 @@ public class JmsTemplate extends JmsDestinationAccessor implements JmsOperations
|
||||
* @see #receive
|
||||
*/
|
||||
@SuppressWarnings("resource")
|
||||
@Nullable
|
||||
public <T> T execute(SessionCallback<T> action, boolean startConnection) throws JmsException {
|
||||
public <T> @Nullable T execute(SessionCallback<T> action, boolean startConnection) throws JmsException {
|
||||
Assert.notNull(action, "Callback object must not be null");
|
||||
Connection conToClose = null;
|
||||
Session sessionToClose = null;
|
||||
@@ -539,8 +530,7 @@ public class JmsTemplate extends JmsDestinationAccessor implements JmsOperations
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public <T> T execute(ProducerCallback<T> action) throws JmsException {
|
||||
public <T> @Nullable T execute(ProducerCallback<T> action) throws JmsException {
|
||||
String defaultDestinationName = getDefaultDestinationName();
|
||||
if (defaultDestinationName != null) {
|
||||
return execute(defaultDestinationName, action);
|
||||
@@ -551,8 +541,7 @@ public class JmsTemplate extends JmsDestinationAccessor implements JmsOperations
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public <T> T execute(final @Nullable Destination destination, final ProducerCallback<T> action) throws JmsException {
|
||||
public <T> @Nullable T execute(final @Nullable Destination destination, final ProducerCallback<T> action) throws JmsException {
|
||||
Assert.notNull(action, "Callback object must not be null");
|
||||
return execute(session -> {
|
||||
MessageProducer producer = createProducer(session, destination);
|
||||
@@ -566,8 +555,7 @@ public class JmsTemplate extends JmsDestinationAccessor implements JmsOperations
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public <T> T execute(final String destinationName, final ProducerCallback<T> action) throws JmsException {
|
||||
public <T> @Nullable T execute(final String destinationName, final ProducerCallback<T> action) throws JmsException {
|
||||
Assert.notNull(action, "Callback object must not be null");
|
||||
return execute(session -> {
|
||||
Destination destination = resolveDestinationName(session, destinationName);
|
||||
@@ -726,8 +714,7 @@ public class JmsTemplate extends JmsDestinationAccessor implements JmsOperations
|
||||
//---------------------------------------------------------------------------------------
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public Message receive() throws JmsException {
|
||||
public @Nullable Message receive() throws JmsException {
|
||||
Destination defaultDestination = getDefaultDestination();
|
||||
if (defaultDestination != null) {
|
||||
return receive(defaultDestination);
|
||||
@@ -738,20 +725,17 @@ public class JmsTemplate extends JmsDestinationAccessor implements JmsOperations
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public Message receive(Destination destination) throws JmsException {
|
||||
public @Nullable Message receive(Destination destination) throws JmsException {
|
||||
return receiveSelected(destination, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public Message receive(String destinationName) throws JmsException {
|
||||
public @Nullable Message receive(String destinationName) throws JmsException {
|
||||
return receiveSelected(destinationName, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public Message receiveSelected(String messageSelector) throws JmsException {
|
||||
public @Nullable Message receiveSelected(String messageSelector) throws JmsException {
|
||||
Destination defaultDestination = getDefaultDestination();
|
||||
if (defaultDestination != null) {
|
||||
return receiveSelected(defaultDestination, messageSelector);
|
||||
@@ -762,14 +746,12 @@ public class JmsTemplate extends JmsDestinationAccessor implements JmsOperations
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public Message receiveSelected(final Destination destination, @Nullable final String messageSelector) throws JmsException {
|
||||
public @Nullable Message receiveSelected(final Destination destination, final @Nullable String messageSelector) throws JmsException {
|
||||
return execute(session -> doReceive(session, destination, messageSelector), true);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public Message receiveSelected(final String destinationName, @Nullable final String messageSelector) throws JmsException {
|
||||
public @Nullable Message receiveSelected(final String destinationName, final @Nullable String messageSelector) throws JmsException {
|
||||
return execute(session -> {
|
||||
Destination destination = resolveDestinationName(session, destinationName);
|
||||
return doReceive(session, destination, messageSelector);
|
||||
@@ -784,8 +766,7 @@ public class JmsTemplate extends JmsDestinationAccessor implements JmsOperations
|
||||
* @return the JMS Message received, or {@code null} if none
|
||||
* @throws JMSException if thrown by JMS API methods
|
||||
*/
|
||||
@Nullable
|
||||
protected Message doReceive(Session session, Destination destination, @Nullable String messageSelector)
|
||||
protected @Nullable Message doReceive(Session session, Destination destination, @Nullable String messageSelector)
|
||||
throws JMSException {
|
||||
|
||||
return doReceive(session, createConsumer(session, destination, messageSelector));
|
||||
@@ -798,8 +779,7 @@ public class JmsTemplate extends JmsDestinationAccessor implements JmsOperations
|
||||
* @return the JMS Message received, or {@code null} if none
|
||||
* @throws JMSException if thrown by JMS API methods
|
||||
*/
|
||||
@Nullable
|
||||
protected Message doReceive(Session session, MessageConsumer consumer) throws JMSException {
|
||||
protected @Nullable Message doReceive(Session session, MessageConsumer consumer) throws JMSException {
|
||||
try {
|
||||
// Use transaction timeout (if available).
|
||||
long timeout = getReceiveTimeout();
|
||||
@@ -838,38 +818,32 @@ public class JmsTemplate extends JmsDestinationAccessor implements JmsOperations
|
||||
//---------------------------------------------------------------------------------------
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public Object receiveAndConvert() throws JmsException {
|
||||
public @Nullable Object receiveAndConvert() throws JmsException {
|
||||
return doConvertFromMessage(receive());
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public Object receiveAndConvert(Destination destination) throws JmsException {
|
||||
public @Nullable Object receiveAndConvert(Destination destination) throws JmsException {
|
||||
return doConvertFromMessage(receive(destination));
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public Object receiveAndConvert(String destinationName) throws JmsException {
|
||||
public @Nullable Object receiveAndConvert(String destinationName) throws JmsException {
|
||||
return doConvertFromMessage(receive(destinationName));
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public Object receiveSelectedAndConvert(String messageSelector) throws JmsException {
|
||||
public @Nullable Object receiveSelectedAndConvert(String messageSelector) throws JmsException {
|
||||
return doConvertFromMessage(receiveSelected(messageSelector));
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public Object receiveSelectedAndConvert(Destination destination, String messageSelector) throws JmsException {
|
||||
public @Nullable Object receiveSelectedAndConvert(Destination destination, String messageSelector) throws JmsException {
|
||||
return doConvertFromMessage(receiveSelected(destination, messageSelector));
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public Object receiveSelectedAndConvert(String destinationName, String messageSelector) throws JmsException {
|
||||
public @Nullable Object receiveSelectedAndConvert(String destinationName, String messageSelector) throws JmsException {
|
||||
return doConvertFromMessage(receiveSelected(destinationName, messageSelector));
|
||||
}
|
||||
|
||||
@@ -878,8 +852,7 @@ public class JmsTemplate extends JmsDestinationAccessor implements JmsOperations
|
||||
* @param message the JMS Message to convert (can be {@code null})
|
||||
* @return the content of the message, or {@code null} if none
|
||||
*/
|
||||
@Nullable
|
||||
protected Object doConvertFromMessage(@Nullable Message message) {
|
||||
protected @Nullable Object doConvertFromMessage(@Nullable Message message) {
|
||||
if (message != null) {
|
||||
try {
|
||||
return getRequiredMessageConverter().fromMessage(message);
|
||||
@@ -897,8 +870,7 @@ public class JmsTemplate extends JmsDestinationAccessor implements JmsOperations
|
||||
//---------------------------------------------------------------------------------------
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public Message sendAndReceive(MessageCreator messageCreator) throws JmsException {
|
||||
public @Nullable Message sendAndReceive(MessageCreator messageCreator) throws JmsException {
|
||||
Destination defaultDestination = getDefaultDestination();
|
||||
if (defaultDestination != null) {
|
||||
return sendAndReceive(defaultDestination, messageCreator);
|
||||
@@ -909,14 +881,12 @@ public class JmsTemplate extends JmsDestinationAccessor implements JmsOperations
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public Message sendAndReceive(final Destination destination, final MessageCreator messageCreator) throws JmsException {
|
||||
public @Nullable Message sendAndReceive(final Destination destination, final MessageCreator messageCreator) throws JmsException {
|
||||
return executeLocal(session -> doSendAndReceive(session, destination, messageCreator), true);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public Message sendAndReceive(final String destinationName, final MessageCreator messageCreator) throws JmsException {
|
||||
public @Nullable Message sendAndReceive(final String destinationName, final MessageCreator messageCreator) throws JmsException {
|
||||
return executeLocal(session -> {
|
||||
Destination destination = resolveDestinationName(session, destinationName);
|
||||
return doSendAndReceive(session, destination, messageCreator);
|
||||
@@ -929,8 +899,7 @@ public class JmsTemplate extends JmsDestinationAccessor implements JmsOperations
|
||||
* <p>Return the response message or {@code null} if no message has
|
||||
* @throws JMSException if thrown by JMS API methods
|
||||
*/
|
||||
@Nullable
|
||||
protected Message doSendAndReceive(Session session, Destination destination, MessageCreator messageCreator)
|
||||
protected @Nullable Message doSendAndReceive(Session session, Destination destination, MessageCreator messageCreator)
|
||||
throws JMSException {
|
||||
|
||||
Assert.notNull(messageCreator, "MessageCreator must not be null");
|
||||
@@ -963,8 +932,7 @@ public class JmsTemplate extends JmsDestinationAccessor implements JmsOperations
|
||||
* creates a non-transactional {@link Session}. The given {@link SessionCallback}
|
||||
* does not participate in an existing transaction.
|
||||
*/
|
||||
@Nullable
|
||||
private <T> T executeLocal(SessionCallback<T> action, boolean startConnection) throws JmsException {
|
||||
private <T> @Nullable T executeLocal(SessionCallback<T> action, boolean startConnection) throws JmsException {
|
||||
Assert.notNull(action, "Callback object must not be null");
|
||||
Connection con = null;
|
||||
Session session = null;
|
||||
@@ -997,8 +965,7 @@ public class JmsTemplate extends JmsDestinationAccessor implements JmsOperations
|
||||
//---------------------------------------------------------------------------------------
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public <T> T browse(BrowserCallback<T> action) throws JmsException {
|
||||
public <T> @Nullable T browse(BrowserCallback<T> action) throws JmsException {
|
||||
Queue defaultQueue = getDefaultQueue();
|
||||
if (defaultQueue != null) {
|
||||
return browse(defaultQueue, action);
|
||||
@@ -1009,20 +976,17 @@ public class JmsTemplate extends JmsDestinationAccessor implements JmsOperations
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public <T> T browse(Queue queue, BrowserCallback<T> action) throws JmsException {
|
||||
public <T> @Nullable T browse(Queue queue, BrowserCallback<T> action) throws JmsException {
|
||||
return browseSelected(queue, null, action);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public <T> T browse(String queueName, BrowserCallback<T> action) throws JmsException {
|
||||
public <T> @Nullable T browse(String queueName, BrowserCallback<T> action) throws JmsException {
|
||||
return browseSelected(queueName, null, action);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public <T> T browseSelected(String messageSelector, BrowserCallback<T> action) throws JmsException {
|
||||
public <T> @Nullable T browseSelected(String messageSelector, BrowserCallback<T> action) throws JmsException {
|
||||
Queue defaultQueue = getDefaultQueue();
|
||||
if (defaultQueue != null) {
|
||||
return browseSelected(defaultQueue, messageSelector, action);
|
||||
@@ -1033,8 +997,7 @@ public class JmsTemplate extends JmsDestinationAccessor implements JmsOperations
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public <T> T browseSelected(final Queue queue, @Nullable final String messageSelector, final BrowserCallback<T> action)
|
||||
public <T> @Nullable T browseSelected(final Queue queue, final @Nullable String messageSelector, final BrowserCallback<T> action)
|
||||
throws JmsException {
|
||||
|
||||
Assert.notNull(action, "Callback object must not be null");
|
||||
@@ -1050,8 +1013,7 @@ public class JmsTemplate extends JmsDestinationAccessor implements JmsOperations
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public <T> T browseSelected(final String queueName, @Nullable final String messageSelector, final BrowserCallback<T> action)
|
||||
public <T> @Nullable T browseSelected(final String queueName, final @Nullable String messageSelector, final BrowserCallback<T> action)
|
||||
throws JmsException {
|
||||
|
||||
Assert.notNull(action, "Callback object must not be null");
|
||||
@@ -1075,8 +1037,7 @@ public class JmsTemplate extends JmsDestinationAccessor implements JmsOperations
|
||||
* @return an appropriate Connection fetched from the holder,
|
||||
* or {@code null} if none found
|
||||
*/
|
||||
@Nullable
|
||||
protected Connection getConnection(JmsResourceHolder holder) {
|
||||
protected @Nullable Connection getConnection(JmsResourceHolder holder) {
|
||||
return holder.getConnection();
|
||||
}
|
||||
|
||||
@@ -1087,8 +1048,7 @@ public class JmsTemplate extends JmsDestinationAccessor implements JmsOperations
|
||||
* @return an appropriate Session fetched from the holder,
|
||||
* or {@code null} if none found
|
||||
*/
|
||||
@Nullable
|
||||
protected Session getSession(JmsResourceHolder holder) {
|
||||
protected @Nullable Session getSession(JmsResourceHolder holder) {
|
||||
return holder.getSession();
|
||||
}
|
||||
|
||||
@@ -1193,14 +1153,12 @@ public class JmsTemplate extends JmsDestinationAccessor implements JmsOperations
|
||||
private class JmsTemplateResourceFactory implements ConnectionFactoryUtils.ResourceFactory {
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public Connection getConnection(JmsResourceHolder holder) {
|
||||
public @Nullable Connection getConnection(JmsResourceHolder holder) {
|
||||
return JmsTemplate.this.getConnection(holder);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public Session getSession(JmsResourceHolder holder) {
|
||||
public @Nullable Session getSession(JmsResourceHolder holder) {
|
||||
return JmsTemplate.this.getSession(holder);
|
||||
}
|
||||
|
||||
|
||||
@@ -19,8 +19,7 @@ package org.springframework.jms.core;
|
||||
import jakarta.jms.JMSException;
|
||||
import jakarta.jms.MessageProducer;
|
||||
import jakarta.jms.Session;
|
||||
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
/**
|
||||
* Callback for sending a message to a JMS destination.
|
||||
@@ -52,7 +51,6 @@ public interface ProducerCallback<T> {
|
||||
* (or {@code null} if none)
|
||||
* @throws jakarta.jms.JMSException if thrown by JMS API methods
|
||||
*/
|
||||
@Nullable
|
||||
T doInJms(Session session, MessageProducer producer) throws JMSException;
|
||||
@Nullable T doInJms(Session session, MessageProducer producer) throws JMSException;
|
||||
|
||||
}
|
||||
|
||||
@@ -18,8 +18,7 @@ package org.springframework.jms.core;
|
||||
|
||||
import jakarta.jms.JMSException;
|
||||
import jakarta.jms.Session;
|
||||
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
/**
|
||||
* Callback for executing any number of operations on a provided {@link Session}.
|
||||
@@ -43,7 +42,6 @@ public interface SessionCallback<T> {
|
||||
* (or {@code null} if none)
|
||||
* @throws jakarta.jms.JMSException if thrown by JMS API methods
|
||||
*/
|
||||
@Nullable
|
||||
T doInJms(Session session) throws JMSException;
|
||||
@Nullable T doInJms(Session session) throws JMSException;
|
||||
|
||||
}
|
||||
|
||||
@@ -2,9 +2,7 @@
|
||||
* Core package of the JMS support.
|
||||
* Provides a JmsTemplate class and various callback interfaces.
|
||||
*/
|
||||
@NonNullApi
|
||||
@NonNullFields
|
||||
@NullMarked
|
||||
package org.springframework.jms.core;
|
||||
|
||||
import org.springframework.lang.NonNullApi;
|
||||
import org.springframework.lang.NonNullFields;
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
|
||||
@@ -19,11 +19,11 @@ package org.springframework.jms.core.support;
|
||||
import jakarta.jms.ConnectionFactory;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
import org.springframework.beans.factory.BeanInitializationException;
|
||||
import org.springframework.beans.factory.InitializingBean;
|
||||
import org.springframework.jms.core.JmsTemplate;
|
||||
import org.springframework.lang.Nullable;
|
||||
|
||||
/**
|
||||
* Convenient superclass for application classes that need JMS access.
|
||||
@@ -45,8 +45,7 @@ public abstract class JmsGatewaySupport implements InitializingBean {
|
||||
/** Logger available to subclasses. */
|
||||
protected final Log logger = LogFactory.getLog(getClass());
|
||||
|
||||
@Nullable
|
||||
private JmsTemplate jmsTemplate;
|
||||
private @Nullable JmsTemplate jmsTemplate;
|
||||
|
||||
|
||||
/**
|
||||
@@ -75,8 +74,7 @@ public abstract class JmsGatewaySupport implements InitializingBean {
|
||||
/**
|
||||
* Return the JMS ConnectionFactory used by the gateway.
|
||||
*/
|
||||
@Nullable
|
||||
public final ConnectionFactory getConnectionFactory() {
|
||||
public final @Nullable ConnectionFactory getConnectionFactory() {
|
||||
return (this.jmsTemplate != null ? this.jmsTemplate.getConnectionFactory() : null);
|
||||
}
|
||||
|
||||
@@ -91,8 +89,7 @@ public abstract class JmsGatewaySupport implements InitializingBean {
|
||||
/**
|
||||
* Return the JmsTemplate for the gateway.
|
||||
*/
|
||||
@Nullable
|
||||
public final JmsTemplate getJmsTemplate() {
|
||||
public final @Nullable JmsTemplate getJmsTemplate() {
|
||||
return this.jmsTemplate;
|
||||
}
|
||||
|
||||
|
||||
@@ -2,9 +2,7 @@
|
||||
* Classes supporting the {@code org.springframework.jms.core} package.
|
||||
* Contains a base class for JmsTemplate usage.
|
||||
*/
|
||||
@NonNullApi
|
||||
@NonNullFields
|
||||
@NullMarked
|
||||
package org.springframework.jms.core.support;
|
||||
|
||||
import org.springframework.lang.NonNullApi;
|
||||
import org.springframework.lang.NonNullFields;
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
|
||||
@@ -25,6 +25,7 @@ import java.util.concurrent.locks.ReentrantLock;
|
||||
|
||||
import jakarta.jms.Connection;
|
||||
import jakarta.jms.JMSException;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
import org.springframework.beans.factory.BeanNameAware;
|
||||
import org.springframework.beans.factory.DisposableBean;
|
||||
@@ -33,7 +34,6 @@ import org.springframework.jms.JmsException;
|
||||
import org.springframework.jms.connection.ConnectionFactoryUtils;
|
||||
import org.springframework.jms.support.JmsUtils;
|
||||
import org.springframework.jms.support.destination.JmsDestinationAccessor;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.util.ClassUtils;
|
||||
|
||||
/**
|
||||
@@ -65,18 +65,15 @@ import org.springframework.util.ClassUtils;
|
||||
public abstract class AbstractJmsListeningContainer extends JmsDestinationAccessor
|
||||
implements BeanNameAware, DisposableBean, SmartLifecycle {
|
||||
|
||||
@Nullable
|
||||
private String clientId;
|
||||
private @Nullable String clientId;
|
||||
|
||||
private boolean autoStartup = true;
|
||||
|
||||
private int phase = DEFAULT_PHASE;
|
||||
|
||||
@Nullable
|
||||
private String beanName;
|
||||
private @Nullable String beanName;
|
||||
|
||||
@Nullable
|
||||
private Connection sharedConnection;
|
||||
private @Nullable Connection sharedConnection;
|
||||
|
||||
private boolean sharedConnectionStarted = false;
|
||||
|
||||
@@ -110,8 +107,7 @@ public abstract class AbstractJmsListeningContainer extends JmsDestinationAccess
|
||||
* Return the JMS client ID for the shared Connection created and used
|
||||
* by this container, if any.
|
||||
*/
|
||||
@Nullable
|
||||
public String getClientId() {
|
||||
public @Nullable String getClientId() {
|
||||
return this.clientId;
|
||||
}
|
||||
|
||||
@@ -158,8 +154,7 @@ public abstract class AbstractJmsListeningContainer extends JmsDestinationAccess
|
||||
* Return the bean name that this listener container has been assigned
|
||||
* in its containing bean factory, if any.
|
||||
*/
|
||||
@Nullable
|
||||
protected final String getBeanName() {
|
||||
protected final @Nullable String getBeanName() {
|
||||
return this.beanName;
|
||||
}
|
||||
|
||||
|
||||
@@ -33,11 +33,11 @@ import jakarta.jms.MessageListener;
|
||||
import jakarta.jms.Queue;
|
||||
import jakarta.jms.Session;
|
||||
import jakarta.jms.Topic;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
import org.springframework.jms.support.JmsUtils;
|
||||
import org.springframework.jms.support.QosSettings;
|
||||
import org.springframework.jms.support.converter.MessageConverter;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.util.ClassUtils;
|
||||
import org.springframework.util.ErrorHandler;
|
||||
|
||||
@@ -154,41 +154,31 @@ public abstract class AbstractMessageListenerContainer extends AbstractJmsListen
|
||||
private static final boolean micrometerJakartaPresent = ClassUtils.isPresent(
|
||||
"io.micrometer.jakarta9.instrument.jms.JmsInstrumentation", AbstractMessageListenerContainer.class.getClassLoader());
|
||||
|
||||
@Nullable
|
||||
private volatile Object destination;
|
||||
private volatile @Nullable Object destination;
|
||||
|
||||
@Nullable
|
||||
private volatile String messageSelector;
|
||||
private volatile @Nullable String messageSelector;
|
||||
|
||||
@Nullable
|
||||
private volatile Object messageListener;
|
||||
private volatile @Nullable Object messageListener;
|
||||
|
||||
private boolean subscriptionDurable = false;
|
||||
|
||||
private boolean subscriptionShared = false;
|
||||
|
||||
@Nullable
|
||||
private String subscriptionName;
|
||||
private @Nullable String subscriptionName;
|
||||
|
||||
@Nullable
|
||||
private Boolean replyPubSubDomain;
|
||||
private @Nullable Boolean replyPubSubDomain;
|
||||
|
||||
@Nullable
|
||||
private QosSettings replyQosSettings;
|
||||
private @Nullable QosSettings replyQosSettings;
|
||||
|
||||
private boolean pubSubNoLocal = false;
|
||||
|
||||
@Nullable
|
||||
private MessageConverter messageConverter;
|
||||
private @Nullable MessageConverter messageConverter;
|
||||
|
||||
@Nullable
|
||||
private ExceptionListener exceptionListener;
|
||||
private @Nullable ExceptionListener exceptionListener;
|
||||
|
||||
@Nullable
|
||||
private ErrorHandler errorHandler;
|
||||
private @Nullable ErrorHandler errorHandler;
|
||||
|
||||
@Nullable
|
||||
private ObservationRegistry observationRegistry;
|
||||
private @Nullable ObservationRegistry observationRegistry;
|
||||
|
||||
private boolean exposeListenerSession = true;
|
||||
|
||||
@@ -223,8 +213,7 @@ public abstract class AbstractMessageListenerContainer extends AbstractJmsListen
|
||||
* if the configured destination is not an actual {@link Destination} type;
|
||||
* c.f. {@link #setDestinationName(String) when the destination is a String}.
|
||||
*/
|
||||
@Nullable
|
||||
public Destination getDestination() {
|
||||
public @Nullable Destination getDestination() {
|
||||
return (this.destination instanceof Destination _destination ? _destination : null);
|
||||
}
|
||||
|
||||
@@ -249,8 +238,7 @@ public abstract class AbstractMessageListenerContainer extends AbstractJmsListen
|
||||
* {@link String} type; c.f. {@link #setDestination(Destination) when
|
||||
* it is an actual Destination}.
|
||||
*/
|
||||
@Nullable
|
||||
public String getDestinationName() {
|
||||
public @Nullable String getDestinationName() {
|
||||
return (this.destination instanceof String name ? name : null);
|
||||
}
|
||||
|
||||
@@ -279,8 +267,7 @@ public abstract class AbstractMessageListenerContainer extends AbstractJmsListen
|
||||
/**
|
||||
* Return the JMS message selector expression (or {@code null} if none).
|
||||
*/
|
||||
@Nullable
|
||||
public String getMessageSelector() {
|
||||
public @Nullable String getMessageSelector() {
|
||||
return this.messageSelector;
|
||||
}
|
||||
|
||||
@@ -309,8 +296,7 @@ public abstract class AbstractMessageListenerContainer extends AbstractJmsListen
|
||||
/**
|
||||
* Return the message listener object to register.
|
||||
*/
|
||||
@Nullable
|
||||
public Object getMessageListener() {
|
||||
public @Nullable Object getMessageListener() {
|
||||
return this.messageListener;
|
||||
}
|
||||
|
||||
@@ -428,8 +414,7 @@ public abstract class AbstractMessageListenerContainer extends AbstractJmsListen
|
||||
* Return the name of a subscription to create, if any.
|
||||
* @since 4.1
|
||||
*/
|
||||
@Nullable
|
||||
public String getSubscriptionName() {
|
||||
public @Nullable String getSubscriptionName() {
|
||||
return this.subscriptionName;
|
||||
}
|
||||
|
||||
@@ -455,8 +440,7 @@ public abstract class AbstractMessageListenerContainer extends AbstractJmsListen
|
||||
/**
|
||||
* Return the name of a durable subscription to create, if any.
|
||||
*/
|
||||
@Nullable
|
||||
public String getDurableSubscriptionName() {
|
||||
public @Nullable String getDurableSubscriptionName() {
|
||||
return (this.subscriptionDurable ? this.subscriptionName : null);
|
||||
}
|
||||
|
||||
@@ -520,8 +504,7 @@ public abstract class AbstractMessageListenerContainer extends AbstractJmsListen
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public QosSettings getReplyQosSettings() {
|
||||
public @Nullable QosSettings getReplyQosSettings() {
|
||||
return this.replyQosSettings;
|
||||
}
|
||||
|
||||
@@ -534,8 +517,7 @@ public abstract class AbstractMessageListenerContainer extends AbstractJmsListen
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public MessageConverter getMessageConverter() {
|
||||
public @Nullable MessageConverter getMessageConverter() {
|
||||
return this.messageConverter;
|
||||
}
|
||||
|
||||
@@ -551,8 +533,7 @@ public abstract class AbstractMessageListenerContainer extends AbstractJmsListen
|
||||
* Return the JMS ExceptionListener to notify in case of a JMSException thrown
|
||||
* by the registered message listener or the invocation infrastructure, if any.
|
||||
*/
|
||||
@Nullable
|
||||
public ExceptionListener getExceptionListener() {
|
||||
public @Nullable ExceptionListener getExceptionListener() {
|
||||
return this.exceptionListener;
|
||||
}
|
||||
|
||||
@@ -571,8 +552,7 @@ public abstract class AbstractMessageListenerContainer extends AbstractJmsListen
|
||||
* thrown while processing a {@link Message}.
|
||||
* @since 4.1
|
||||
*/
|
||||
@Nullable
|
||||
public ErrorHandler getErrorHandler() {
|
||||
public @Nullable ErrorHandler getErrorHandler() {
|
||||
return this.errorHandler;
|
||||
}
|
||||
|
||||
@@ -591,8 +571,7 @@ public abstract class AbstractMessageListenerContainer extends AbstractJmsListen
|
||||
* {@link JmsObservationDocumentation#JMS_MESSAGE_PROCESS JMS message processing observations}.
|
||||
* @since 6.1
|
||||
*/
|
||||
@Nullable
|
||||
public ObservationRegistry getObservationRegistry() {
|
||||
public @Nullable ObservationRegistry getObservationRegistry() {
|
||||
return this.observationRegistry;
|
||||
}
|
||||
|
||||
|
||||
@@ -23,12 +23,12 @@ import jakarta.jms.JMSException;
|
||||
import jakarta.jms.Message;
|
||||
import jakarta.jms.MessageConsumer;
|
||||
import jakarta.jms.Session;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
import org.springframework.jms.connection.ConnectionFactoryUtils;
|
||||
import org.springframework.jms.connection.JmsResourceHolder;
|
||||
import org.springframework.jms.connection.SingleConnectionFactory;
|
||||
import org.springframework.jms.support.JmsUtils;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.transaction.PlatformTransactionManager;
|
||||
import org.springframework.transaction.TransactionException;
|
||||
import org.springframework.transaction.TransactionStatus;
|
||||
@@ -89,8 +89,7 @@ public abstract class AbstractPollingMessageListenerContainer extends AbstractMe
|
||||
|
||||
private boolean sessionTransactedCalled = false;
|
||||
|
||||
@Nullable
|
||||
private PlatformTransactionManager transactionManager;
|
||||
private @Nullable PlatformTransactionManager transactionManager;
|
||||
|
||||
private final DefaultTransactionDefinition transactionDefinition = new DefaultTransactionDefinition();
|
||||
|
||||
@@ -133,8 +132,7 @@ public abstract class AbstractPollingMessageListenerContainer extends AbstractMe
|
||||
* Return the Spring PlatformTransactionManager to use for transactional
|
||||
* wrapping of message receipt plus listener execution.
|
||||
*/
|
||||
@Nullable
|
||||
protected final PlatformTransactionManager getTransactionManager() {
|
||||
protected final @Nullable PlatformTransactionManager getTransactionManager() {
|
||||
return this.transactionManager;
|
||||
}
|
||||
|
||||
@@ -436,8 +434,7 @@ public abstract class AbstractPollingMessageListenerContainer extends AbstractMe
|
||||
* @return the Message, or {@code null} if none
|
||||
* @throws JMSException if thrown by JMS methods
|
||||
*/
|
||||
@Nullable
|
||||
protected Message receiveMessage(MessageConsumer consumer) throws JMSException {
|
||||
protected @Nullable Message receiveMessage(MessageConsumer consumer) throws JMSException {
|
||||
return receiveFromConsumer(consumer, getReceiveTimeout());
|
||||
}
|
||||
|
||||
@@ -468,8 +465,7 @@ public abstract class AbstractPollingMessageListenerContainer extends AbstractMe
|
||||
* @return an appropriate Connection fetched from the holder,
|
||||
* or {@code null} if none found
|
||||
*/
|
||||
@Nullable
|
||||
protected Connection getConnection(JmsResourceHolder holder) {
|
||||
protected @Nullable Connection getConnection(JmsResourceHolder holder) {
|
||||
return holder.getConnection();
|
||||
}
|
||||
|
||||
@@ -480,8 +476,7 @@ public abstract class AbstractPollingMessageListenerContainer extends AbstractMe
|
||||
* @return an appropriate Session fetched from the holder,
|
||||
* or {@code null} if none found
|
||||
*/
|
||||
@Nullable
|
||||
protected Session getSession(JmsResourceHolder holder) {
|
||||
protected @Nullable Session getSession(JmsResourceHolder holder) {
|
||||
return holder.getSession();
|
||||
}
|
||||
|
||||
@@ -492,14 +487,12 @@ public abstract class AbstractPollingMessageListenerContainer extends AbstractMe
|
||||
private class MessageListenerContainerResourceFactory implements ConnectionFactoryUtils.ResourceFactory {
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public Connection getConnection(JmsResourceHolder holder) {
|
||||
public @Nullable Connection getConnection(JmsResourceHolder holder) {
|
||||
return AbstractPollingMessageListenerContainer.this.getConnection(holder);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public Session getSession(JmsResourceHolder holder) {
|
||||
public @Nullable Session getSession(JmsResourceHolder holder) {
|
||||
return AbstractPollingMessageListenerContainer.this.getSession(holder);
|
||||
}
|
||||
|
||||
|
||||
@@ -28,6 +28,7 @@ import jakarta.jms.Connection;
|
||||
import jakarta.jms.JMSException;
|
||||
import jakarta.jms.MessageConsumer;
|
||||
import jakarta.jms.Session;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
import org.springframework.core.task.SimpleAsyncTaskExecutor;
|
||||
import org.springframework.core.task.TaskExecutor;
|
||||
@@ -35,7 +36,6 @@ import org.springframework.jms.JmsException;
|
||||
import org.springframework.jms.support.JmsUtils;
|
||||
import org.springframework.jms.support.destination.CachingDestinationResolver;
|
||||
import org.springframework.jms.support.destination.DestinationResolver;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.scheduling.SchedulingAwareRunnable;
|
||||
import org.springframework.scheduling.SchedulingTaskExecutor;
|
||||
import org.springframework.util.Assert;
|
||||
@@ -190,8 +190,7 @@ public class DefaultMessageListenerContainer extends AbstractPollingMessageListe
|
||||
);
|
||||
|
||||
|
||||
@Nullable
|
||||
private Executor taskExecutor;
|
||||
private @Nullable Executor taskExecutor;
|
||||
|
||||
private boolean virtualThreads = false;
|
||||
|
||||
@@ -221,8 +220,7 @@ public class DefaultMessageListenerContainer extends AbstractPollingMessageListe
|
||||
|
||||
private volatile boolean interrupted;
|
||||
|
||||
@Nullable
|
||||
private Runnable stopCallback;
|
||||
private @Nullable Runnable stopCallback;
|
||||
|
||||
private Object currentRecoveryMarker = new Object();
|
||||
|
||||
@@ -1246,14 +1244,11 @@ public class DefaultMessageListenerContainer extends AbstractPollingMessageListe
|
||||
*/
|
||||
private class AsyncMessageListenerInvoker implements SchedulingAwareRunnable {
|
||||
|
||||
@Nullable
|
||||
private Session session;
|
||||
private @Nullable Session session;
|
||||
|
||||
@Nullable
|
||||
private MessageConsumer consumer;
|
||||
private @Nullable MessageConsumer consumer;
|
||||
|
||||
@Nullable
|
||||
private Object lastRecoveryMarker;
|
||||
private @Nullable Object lastRecoveryMarker;
|
||||
|
||||
private boolean lastMessageSucceeded;
|
||||
|
||||
@@ -1261,8 +1256,7 @@ public class DefaultMessageListenerContainer extends AbstractPollingMessageListe
|
||||
|
||||
private volatile boolean idle = true;
|
||||
|
||||
@Nullable
|
||||
private volatile Thread currentReceiveThread;
|
||||
private volatile @Nullable Thread currentReceiveThread;
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
|
||||
@@ -16,11 +16,12 @@
|
||||
|
||||
package org.springframework.jms.listener;
|
||||
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
import org.springframework.context.SmartLifecycle;
|
||||
import org.springframework.jms.support.QosSettings;
|
||||
import org.springframework.jms.support.converter.MessageConverter;
|
||||
import org.springframework.jms.support.destination.DestinationResolver;
|
||||
import org.springframework.lang.Nullable;
|
||||
|
||||
/**
|
||||
* Internal abstraction used by the framework representing a message
|
||||
@@ -42,15 +43,13 @@ public interface MessageListenerContainer extends SmartLifecycle {
|
||||
* Return the {@link MessageConverter} that can be used to
|
||||
* convert {@link jakarta.jms.Message}, if any.
|
||||
*/
|
||||
@Nullable
|
||||
MessageConverter getMessageConverter();
|
||||
@Nullable MessageConverter getMessageConverter();
|
||||
|
||||
/**
|
||||
* Return the {@link DestinationResolver} to use to resolve
|
||||
* destinations by names.
|
||||
*/
|
||||
@Nullable
|
||||
DestinationResolver getDestinationResolver();
|
||||
@Nullable DestinationResolver getDestinationResolver();
|
||||
|
||||
/**
|
||||
* Return whether the Publish/Subscribe domain ({@link jakarta.jms.Topic Topics}) is used.
|
||||
@@ -71,7 +70,6 @@ public interface MessageListenerContainer extends SmartLifecycle {
|
||||
* or {@code null} if the broker's defaults should be used.
|
||||
* @since 5.0
|
||||
*/
|
||||
@Nullable
|
||||
QosSettings getReplyQosSettings();
|
||||
@Nullable QosSettings getReplyQosSettings();
|
||||
|
||||
}
|
||||
|
||||
@@ -30,9 +30,9 @@ import jakarta.jms.JMSException;
|
||||
import jakarta.jms.Message;
|
||||
import jakarta.jms.MessageConsumer;
|
||||
import jakarta.jms.Session;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
import org.springframework.jms.support.JmsUtils;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.transaction.support.TransactionSynchronizationManager;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
@@ -73,14 +73,11 @@ public class SimpleMessageListenerContainer extends AbstractMessageListenerConta
|
||||
|
||||
private int concurrentConsumers = 1;
|
||||
|
||||
@Nullable
|
||||
private Executor taskExecutor;
|
||||
private @Nullable Executor taskExecutor;
|
||||
|
||||
@Nullable
|
||||
private Set<Session> sessions;
|
||||
private @Nullable Set<Session> sessions;
|
||||
|
||||
@Nullable
|
||||
private Set<MessageConsumer> consumers;
|
||||
private @Nullable Set<MessageConsumer> consumers;
|
||||
|
||||
private final Lock consumersLock = new ReentrantLock();
|
||||
|
||||
|
||||
@@ -26,6 +26,7 @@ import jakarta.jms.MessageProducer;
|
||||
import jakarta.jms.Session;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
import org.springframework.jms.listener.SessionAwareMessageListener;
|
||||
import org.springframework.jms.support.JmsHeaderMapper;
|
||||
@@ -39,7 +40,6 @@ import org.springframework.jms.support.converter.SimpleMessageConverter;
|
||||
import org.springframework.jms.support.converter.SmartMessageConverter;
|
||||
import org.springframework.jms.support.destination.DestinationResolver;
|
||||
import org.springframework.jms.support.destination.DynamicDestinationResolver;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.messaging.MessageHeaders;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
@@ -59,18 +59,15 @@ public abstract class AbstractAdaptableMessageListener
|
||||
/** Logger available to subclasses. */
|
||||
protected final Log logger = LogFactory.getLog(getClass());
|
||||
|
||||
@Nullable
|
||||
private Object defaultResponseDestination;
|
||||
private @Nullable Object defaultResponseDestination;
|
||||
|
||||
private DestinationResolver destinationResolver = new DynamicDestinationResolver();
|
||||
|
||||
@Nullable
|
||||
private MessageConverter messageConverter = new SimpleMessageConverter();
|
||||
private @Nullable MessageConverter messageConverter = new SimpleMessageConverter();
|
||||
|
||||
private final MessagingMessageConverterAdapter messagingMessageConverter = new MessagingMessageConverterAdapter();
|
||||
|
||||
@Nullable
|
||||
private QosSettings responseQosSettings;
|
||||
private @Nullable QosSettings responseQosSettings;
|
||||
|
||||
|
||||
/**
|
||||
@@ -151,8 +148,7 @@ public abstract class AbstractAdaptableMessageListener
|
||||
* listener method arguments, and objects returned from listener
|
||||
* methods back to JMS messages.
|
||||
*/
|
||||
@Nullable
|
||||
protected MessageConverter getMessageConverter() {
|
||||
protected @Nullable MessageConverter getMessageConverter() {
|
||||
return this.messageConverter;
|
||||
}
|
||||
|
||||
@@ -190,8 +186,7 @@ public abstract class AbstractAdaptableMessageListener
|
||||
* or {@code null} if the defaults should be used.
|
||||
* @since 5.0
|
||||
*/
|
||||
@Nullable
|
||||
protected QosSettings getResponseQosSettings() {
|
||||
protected @Nullable QosSettings getResponseQosSettings() {
|
||||
return this.responseQosSettings;
|
||||
}
|
||||
|
||||
@@ -405,8 +400,7 @@ public abstract class AbstractAdaptableMessageListener
|
||||
* @see #setDefaultResponseTopicName
|
||||
* @see #setDestinationResolver
|
||||
*/
|
||||
@Nullable
|
||||
protected Destination resolveDefaultResponseDestination(Session session) throws JMSException {
|
||||
protected @Nullable Destination resolveDefaultResponseDestination(Session session) throws JMSException {
|
||||
if (this.defaultResponseDestination instanceof Destination destination) {
|
||||
return destination;
|
||||
}
|
||||
@@ -504,11 +498,9 @@ public abstract class AbstractAdaptableMessageListener
|
||||
|
||||
private final jakarta.jms.Message message;
|
||||
|
||||
@Nullable
|
||||
private Object payload;
|
||||
private @Nullable Object payload;
|
||||
|
||||
@Nullable
|
||||
private MessageHeaders headers;
|
||||
private @Nullable MessageHeaders headers;
|
||||
|
||||
public LazyResolutionMessage(jakarta.jms.Message message) {
|
||||
this.message = message;
|
||||
|
||||
@@ -19,9 +19,9 @@ package org.springframework.jms.listener.adapter;
|
||||
import jakarta.jms.Destination;
|
||||
import jakarta.jms.JMSException;
|
||||
import jakarta.jms.Session;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
import org.springframework.jms.support.destination.DestinationResolver;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
/**
|
||||
@@ -87,8 +87,7 @@ public class JmsResponse<T> {
|
||||
* @return the {@link Destination} to use
|
||||
* @throws JMSException if the DestinationResolver failed to resolve the destination
|
||||
*/
|
||||
@Nullable
|
||||
public Destination resolveDestination(DestinationResolver destinationResolver, Session session)
|
||||
public @Nullable Destination resolveDestination(DestinationResolver destinationResolver, Session session)
|
||||
throws JMSException {
|
||||
|
||||
if (this.destination instanceof Destination dest) {
|
||||
|
||||
@@ -22,12 +22,12 @@ import jakarta.jms.JMSException;
|
||||
import jakarta.jms.Message;
|
||||
import jakarta.jms.MessageListener;
|
||||
import jakarta.jms.Session;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
import org.springframework.jms.listener.SessionAwareMessageListener;
|
||||
import org.springframework.jms.listener.SubscriptionNameProvider;
|
||||
import org.springframework.jms.support.converter.MessageConverter;
|
||||
import org.springframework.jms.support.converter.SimpleMessageConverter;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.MethodInvoker;
|
||||
import org.springframework.util.ObjectUtils;
|
||||
@@ -284,8 +284,7 @@ public class MessageListenerAdapter extends AbstractAdaptableMessageListener imp
|
||||
* @see #getListenerMethodName
|
||||
* @see #buildListenerArguments
|
||||
*/
|
||||
@Nullable
|
||||
protected Object invokeListenerMethod(String methodName, Object[] arguments) throws JMSException {
|
||||
protected @Nullable Object invokeListenerMethod(String methodName, Object[] arguments) throws JMSException {
|
||||
try {
|
||||
MethodInvoker methodInvoker = new MethodInvoker();
|
||||
methodInvoker.setTargetObject(getDelegate());
|
||||
|
||||
@@ -18,12 +18,12 @@ package org.springframework.jms.listener.adapter;
|
||||
|
||||
import jakarta.jms.JMSException;
|
||||
import jakarta.jms.Session;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
import org.springframework.core.MethodParameter;
|
||||
import org.springframework.jms.listener.SubscriptionNameProvider;
|
||||
import org.springframework.jms.support.JmsHeaderMapper;
|
||||
import org.springframework.jms.support.converter.MessageConversionException;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.messaging.Message;
|
||||
import org.springframework.messaging.MessagingException;
|
||||
import org.springframework.messaging.core.AbstractMessageSendingTemplate;
|
||||
@@ -57,8 +57,7 @@ import org.springframework.util.Assert;
|
||||
public class MessagingMessageListenerAdapter extends AbstractAdaptableMessageListener
|
||||
implements SubscriptionNameProvider {
|
||||
|
||||
@Nullable
|
||||
private InvocableHandlerMethod handlerMethod;
|
||||
private @Nullable InvocableHandlerMethod handlerMethod;
|
||||
|
||||
|
||||
/**
|
||||
@@ -103,8 +102,7 @@ public class MessagingMessageListenerAdapter extends AbstractAdaptableMessageLis
|
||||
* Invoke the handler, wrapping any exception in a {@link ListenerExecutionFailedException}
|
||||
* with a dedicated error message.
|
||||
*/
|
||||
@Nullable
|
||||
private Object invokeHandler(jakarta.jms.Message jmsMessage, @Nullable Session session, Message<?> message) {
|
||||
private @Nullable Object invokeHandler(jakarta.jms.Message jmsMessage, @Nullable Session session, Message<?> message) {
|
||||
InvocableHandlerMethod handlerMethod = getHandlerMethod();
|
||||
try {
|
||||
return handlerMethod.invoke(message, jmsMessage, session);
|
||||
|
||||
@@ -3,9 +3,7 @@
|
||||
* methods, converting messages to appropriate message content types
|
||||
* (such as String or byte array) that get passed into listener methods.
|
||||
*/
|
||||
@NonNullApi
|
||||
@NonNullFields
|
||||
@NullMarked
|
||||
package org.springframework.jms.listener.adapter;
|
||||
|
||||
import org.springframework.lang.NonNullApi;
|
||||
import org.springframework.lang.NonNullFields;
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
|
||||
@@ -19,10 +19,10 @@ package org.springframework.jms.listener.endpoint;
|
||||
import java.util.Map;
|
||||
|
||||
import jakarta.jms.Session;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
import org.springframework.jms.support.QosSettings;
|
||||
import org.springframework.jms.support.converter.MessageConverter;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
/**
|
||||
@@ -55,29 +55,23 @@ public class JmsActivationSpecConfig {
|
||||
);
|
||||
|
||||
|
||||
@Nullable
|
||||
private String destinationName;
|
||||
private @Nullable String destinationName;
|
||||
|
||||
private boolean pubSubDomain = false;
|
||||
|
||||
@Nullable
|
||||
private Boolean replyPubSubDomain;
|
||||
private @Nullable Boolean replyPubSubDomain;
|
||||
|
||||
@Nullable
|
||||
private QosSettings replyQosSettings;
|
||||
private @Nullable QosSettings replyQosSettings;
|
||||
|
||||
private boolean subscriptionDurable = false;
|
||||
|
||||
private boolean subscriptionShared = false;
|
||||
|
||||
@Nullable
|
||||
private String subscriptionName;
|
||||
private @Nullable String subscriptionName;
|
||||
|
||||
@Nullable
|
||||
private String clientId;
|
||||
private @Nullable String clientId;
|
||||
|
||||
@Nullable
|
||||
private String messageSelector;
|
||||
private @Nullable String messageSelector;
|
||||
|
||||
private int acknowledgeMode = Session.AUTO_ACKNOWLEDGE;
|
||||
|
||||
@@ -85,16 +79,14 @@ public class JmsActivationSpecConfig {
|
||||
|
||||
private int prefetchSize = -1;
|
||||
|
||||
@Nullable
|
||||
private MessageConverter messageConverter;
|
||||
private @Nullable MessageConverter messageConverter;
|
||||
|
||||
|
||||
public void setDestinationName(@Nullable String destinationName) {
|
||||
this.destinationName = destinationName;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public String getDestinationName() {
|
||||
public @Nullable String getDestinationName() {
|
||||
return this.destinationName;
|
||||
}
|
||||
|
||||
@@ -123,8 +115,7 @@ public class JmsActivationSpecConfig {
|
||||
this.replyQosSettings = replyQosSettings;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public QosSettings getReplyQosSettings() {
|
||||
public @Nullable QosSettings getReplyQosSettings() {
|
||||
return this.replyQosSettings;
|
||||
}
|
||||
|
||||
@@ -154,8 +145,7 @@ public class JmsActivationSpecConfig {
|
||||
this.subscriptionName = subscriptionName;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public String getSubscriptionName() {
|
||||
public @Nullable String getSubscriptionName() {
|
||||
return this.subscriptionName;
|
||||
}
|
||||
|
||||
@@ -164,8 +154,7 @@ public class JmsActivationSpecConfig {
|
||||
this.subscriptionDurable = (durableSubscriptionName != null);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public String getDurableSubscriptionName() {
|
||||
public @Nullable String getDurableSubscriptionName() {
|
||||
return (this.subscriptionDurable ? this.subscriptionName : null);
|
||||
}
|
||||
|
||||
@@ -173,8 +162,7 @@ public class JmsActivationSpecConfig {
|
||||
this.clientId = clientId;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public String getClientId() {
|
||||
public @Nullable String getClientId() {
|
||||
return this.clientId;
|
||||
}
|
||||
|
||||
@@ -182,8 +170,7 @@ public class JmsActivationSpecConfig {
|
||||
this.messageSelector = messageSelector;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public String getMessageSelector() {
|
||||
public @Nullable String getMessageSelector() {
|
||||
return this.messageSelector;
|
||||
}
|
||||
|
||||
@@ -297,8 +284,7 @@ public class JmsActivationSpecConfig {
|
||||
/**
|
||||
* Return the {@link MessageConverter} to use, if any.
|
||||
*/
|
||||
@Nullable
|
||||
public MessageConverter getMessageConverter() {
|
||||
public @Nullable MessageConverter getMessageConverter() {
|
||||
return this.messageConverter;
|
||||
}
|
||||
|
||||
|
||||
@@ -20,9 +20,9 @@ import jakarta.jms.Message;
|
||||
import jakarta.jms.MessageListener;
|
||||
import jakarta.resource.ResourceException;
|
||||
import jakarta.resource.spi.UnavailableException;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
import org.springframework.jca.endpoint.AbstractMessageEndpointFactory;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
/**
|
||||
@@ -49,8 +49,7 @@ import org.springframework.util.Assert;
|
||||
*/
|
||||
public class JmsMessageEndpointFactory extends AbstractMessageEndpointFactory {
|
||||
|
||||
@Nullable
|
||||
private MessageListener messageListener;
|
||||
private @Nullable MessageListener messageListener;
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@@ -18,6 +18,7 @@ package org.springframework.jms.listener.endpoint;
|
||||
|
||||
import jakarta.jms.MessageListener;
|
||||
import jakarta.resource.ResourceException;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
import org.springframework.beans.factory.BeanNameAware;
|
||||
import org.springframework.jca.endpoint.GenericMessageEndpointManager;
|
||||
@@ -25,7 +26,6 @@ import org.springframework.jms.listener.MessageListenerContainer;
|
||||
import org.springframework.jms.support.QosSettings;
|
||||
import org.springframework.jms.support.converter.MessageConverter;
|
||||
import org.springframework.jms.support.destination.DestinationResolver;
|
||||
import org.springframework.lang.Nullable;
|
||||
|
||||
/**
|
||||
* Extension of the generic JCA 1.5
|
||||
@@ -60,8 +60,7 @@ public class JmsMessageEndpointManager extends GenericMessageEndpointManager
|
||||
|
||||
private JmsActivationSpecFactory activationSpecFactory = new DefaultJmsActivationSpecFactory();
|
||||
|
||||
@Nullable
|
||||
private JmsActivationSpecConfig activationSpecConfig;
|
||||
private @Nullable JmsActivationSpecConfig activationSpecConfig;
|
||||
|
||||
|
||||
/**
|
||||
@@ -146,8 +145,7 @@ public class JmsMessageEndpointManager extends GenericMessageEndpointManager
|
||||
* Return the {@link JmsActivationSpecConfig} object that this endpoint manager
|
||||
* should use for activating its listener. Return {@code null} if none is set.
|
||||
*/
|
||||
@Nullable
|
||||
public JmsActivationSpecConfig getActivationSpecConfig() {
|
||||
public @Nullable JmsActivationSpecConfig getActivationSpecConfig() {
|
||||
return this.activationSpecConfig;
|
||||
}
|
||||
|
||||
@@ -191,8 +189,7 @@ public class JmsMessageEndpointManager extends GenericMessageEndpointManager
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public MessageConverter getMessageConverter() {
|
||||
public @Nullable MessageConverter getMessageConverter() {
|
||||
JmsActivationSpecConfig config = getActivationSpecConfig();
|
||||
if (config != null) {
|
||||
return config.getMessageConverter();
|
||||
@@ -201,8 +198,7 @@ public class JmsMessageEndpointManager extends GenericMessageEndpointManager
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public DestinationResolver getDestinationResolver() {
|
||||
public @Nullable DestinationResolver getDestinationResolver() {
|
||||
if (this.activationSpecFactory instanceof StandardJmsActivationSpecFactory standardFactory) {
|
||||
return standardFactory.getDestinationResolver();
|
||||
}
|
||||
@@ -228,8 +224,7 @@ public class JmsMessageEndpointManager extends GenericMessageEndpointManager
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public QosSettings getReplyQosSettings() {
|
||||
public @Nullable QosSettings getReplyQosSettings() {
|
||||
JmsActivationSpecConfig config = getActivationSpecConfig();
|
||||
if (config != null) {
|
||||
return config.getReplyQosSettings();
|
||||
|
||||
@@ -24,13 +24,13 @@ import jakarta.jms.Session;
|
||||
import jakarta.jms.Topic;
|
||||
import jakarta.resource.spi.ActivationSpec;
|
||||
import jakarta.resource.spi.ResourceAdapter;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.BeanWrapper;
|
||||
import org.springframework.beans.PropertyAccessorFactory;
|
||||
import org.springframework.jms.support.destination.DestinationResolutionException;
|
||||
import org.springframework.jms.support.destination.DestinationResolver;
|
||||
import org.springframework.lang.Nullable;
|
||||
|
||||
/**
|
||||
* Standard implementation of the {@link JmsActivationSpecFactory} interface.
|
||||
@@ -52,14 +52,11 @@ import org.springframework.lang.Nullable;
|
||||
*/
|
||||
public class StandardJmsActivationSpecFactory implements JmsActivationSpecFactory {
|
||||
|
||||
@Nullable
|
||||
private Class<?> activationSpecClass;
|
||||
private @Nullable Class<?> activationSpecClass;
|
||||
|
||||
@Nullable
|
||||
private Map<String, String> defaultProperties;
|
||||
private @Nullable Map<String, String> defaultProperties;
|
||||
|
||||
@Nullable
|
||||
private DestinationResolver destinationResolver;
|
||||
private @Nullable DestinationResolver destinationResolver;
|
||||
|
||||
|
||||
/**
|
||||
@@ -98,8 +95,7 @@ public class StandardJmsActivationSpecFactory implements JmsActivationSpecFactor
|
||||
/**
|
||||
* Return the {@link DestinationResolver} to use for resolving destinations names.
|
||||
*/
|
||||
@Nullable
|
||||
public DestinationResolver getDestinationResolver() {
|
||||
public @Nullable DestinationResolver getDestinationResolver() {
|
||||
return this.destinationResolver;
|
||||
}
|
||||
|
||||
@@ -131,8 +127,7 @@ public class StandardJmsActivationSpecFactory implements JmsActivationSpecFactor
|
||||
* if not determinable
|
||||
* @see #setActivationSpecClass
|
||||
*/
|
||||
@Nullable
|
||||
protected Class<?> determineActivationSpecClass(ResourceAdapter adapter) {
|
||||
protected @Nullable Class<?> determineActivationSpecClass(ResourceAdapter adapter) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
/**
|
||||
* This package provides JCA-based endpoint management for JMS message listeners.
|
||||
*/
|
||||
@NonNullApi
|
||||
@NonNullFields
|
||||
@NullMarked
|
||||
package org.springframework.jms.listener.endpoint;
|
||||
|
||||
import org.springframework.lang.NonNullApi;
|
||||
import org.springframework.lang.NonNullFields;
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
|
||||
@@ -3,9 +3,7 @@
|
||||
* It also offers the DefaultMessageListenerContainer and SimpleMessageListenerContainer
|
||||
* implementations, based on the plain JMS client API.
|
||||
*/
|
||||
@NonNullApi
|
||||
@NonNullFields
|
||||
@NullMarked
|
||||
package org.springframework.jms.listener;
|
||||
|
||||
import org.springframework.lang.NonNullApi;
|
||||
import org.springframework.lang.NonNullFields;
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
|
||||
@@ -2,9 +2,7 @@
|
||||
* This package contains integration classes for JMS,
|
||||
* allowing for Spring-style JMS access.
|
||||
*/
|
||||
@NonNullApi
|
||||
@NonNullFields
|
||||
@NullMarked
|
||||
package org.springframework.jms;
|
||||
|
||||
import org.springframework.lang.NonNullApi;
|
||||
import org.springframework.lang.NonNullFields;
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
|
||||
@@ -24,10 +24,10 @@ import jakarta.jms.JMSException;
|
||||
import jakarta.jms.Session;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
import org.springframework.beans.factory.InitializingBean;
|
||||
import org.springframework.jms.JmsException;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
/**
|
||||
@@ -63,8 +63,7 @@ public abstract class JmsAccessor implements InitializingBean {
|
||||
/** Logger available to subclasses. */
|
||||
protected final Log logger = LogFactory.getLog(getClass());
|
||||
|
||||
@Nullable
|
||||
private ConnectionFactory connectionFactory;
|
||||
private @Nullable ConnectionFactory connectionFactory;
|
||||
|
||||
private boolean sessionTransacted = false;
|
||||
|
||||
@@ -82,8 +81,7 @@ public abstract class JmsAccessor implements InitializingBean {
|
||||
* Return the ConnectionFactory that this accessor uses for obtaining
|
||||
* JMS {@link Connection Connections}.
|
||||
*/
|
||||
@Nullable
|
||||
public ConnectionFactory getConnectionFactory() {
|
||||
public @Nullable ConnectionFactory getConnectionFactory() {
|
||||
return this.connectionFactory;
|
||||
}
|
||||
|
||||
|
||||
@@ -20,8 +20,8 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import jakarta.jms.Destination;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.messaging.Message;
|
||||
import org.springframework.messaging.support.NativeMessageHeaderAccessor;
|
||||
|
||||
@@ -47,8 +47,7 @@ public class JmsMessageHeaderAccessor extends NativeMessageHeaderAccessor {
|
||||
* Return the {@link JmsHeaders#CORRELATION_ID correlationId}.
|
||||
* @see JmsHeaders#CORRELATION_ID
|
||||
*/
|
||||
@Nullable
|
||||
public String getCorrelationId() {
|
||||
public @Nullable String getCorrelationId() {
|
||||
return (String) getHeader(JmsHeaders.CORRELATION_ID);
|
||||
}
|
||||
|
||||
@@ -56,8 +55,7 @@ public class JmsMessageHeaderAccessor extends NativeMessageHeaderAccessor {
|
||||
* Return the {@link JmsHeaders#DESTINATION destination}.
|
||||
* @see JmsHeaders#DESTINATION
|
||||
*/
|
||||
@Nullable
|
||||
public Destination getDestination() {
|
||||
public @Nullable Destination getDestination() {
|
||||
return (Destination) getHeader(JmsHeaders.DESTINATION);
|
||||
}
|
||||
|
||||
@@ -65,8 +63,7 @@ public class JmsMessageHeaderAccessor extends NativeMessageHeaderAccessor {
|
||||
* Return the {@link JmsHeaders#DELIVERY_MODE delivery mode}.
|
||||
* @see JmsHeaders#DELIVERY_MODE
|
||||
*/
|
||||
@Nullable
|
||||
public Integer getDeliveryMode() {
|
||||
public @Nullable Integer getDeliveryMode() {
|
||||
return (Integer) getHeader(JmsHeaders.DELIVERY_MODE);
|
||||
}
|
||||
|
||||
@@ -74,8 +71,7 @@ public class JmsMessageHeaderAccessor extends NativeMessageHeaderAccessor {
|
||||
* Return the message {@link JmsHeaders#EXPIRATION expiration}.
|
||||
* @see JmsHeaders#EXPIRATION
|
||||
*/
|
||||
@Nullable
|
||||
public Long getExpiration() {
|
||||
public @Nullable Long getExpiration() {
|
||||
return (Long) getHeader(JmsHeaders.EXPIRATION);
|
||||
}
|
||||
|
||||
@@ -83,8 +79,7 @@ public class JmsMessageHeaderAccessor extends NativeMessageHeaderAccessor {
|
||||
* Return the {@link JmsHeaders#MESSAGE_ID message id}.
|
||||
* @see JmsHeaders#MESSAGE_ID
|
||||
*/
|
||||
@Nullable
|
||||
public String getMessageId() {
|
||||
public @Nullable String getMessageId() {
|
||||
return (String) getHeader(JmsHeaders.MESSAGE_ID);
|
||||
}
|
||||
|
||||
@@ -92,8 +87,7 @@ public class JmsMessageHeaderAccessor extends NativeMessageHeaderAccessor {
|
||||
* Return the {@link JmsHeaders#PRIORITY priority}.
|
||||
* @see JmsHeaders#PRIORITY
|
||||
*/
|
||||
@Nullable
|
||||
public Integer getPriority() {
|
||||
public @Nullable Integer getPriority() {
|
||||
return (Integer) getHeader(JmsHeaders.PRIORITY);
|
||||
}
|
||||
|
||||
@@ -101,8 +95,7 @@ public class JmsMessageHeaderAccessor extends NativeMessageHeaderAccessor {
|
||||
* Return the {@link JmsHeaders#REPLY_TO reply to}.
|
||||
* @see JmsHeaders#REPLY_TO
|
||||
*/
|
||||
@Nullable
|
||||
public Destination getReplyTo() {
|
||||
public @Nullable Destination getReplyTo() {
|
||||
return (Destination) getHeader(JmsHeaders.REPLY_TO);
|
||||
}
|
||||
|
||||
@@ -110,8 +103,7 @@ public class JmsMessageHeaderAccessor extends NativeMessageHeaderAccessor {
|
||||
* Return the {@link JmsHeaders#REDELIVERED redelivered} flag.
|
||||
* @see JmsHeaders#REDELIVERED
|
||||
*/
|
||||
@Nullable
|
||||
public Boolean getRedelivered() {
|
||||
public @Nullable Boolean getRedelivered() {
|
||||
return (Boolean) getHeader(JmsHeaders.REDELIVERED);
|
||||
}
|
||||
|
||||
@@ -119,8 +111,7 @@ public class JmsMessageHeaderAccessor extends NativeMessageHeaderAccessor {
|
||||
* Return the {@link JmsHeaders#TYPE type}.
|
||||
* @see JmsHeaders#TYPE
|
||||
*/
|
||||
@Nullable
|
||||
public String getType() {
|
||||
public @Nullable String getType() {
|
||||
return (String) getHeader(JmsHeaders.TYPE);
|
||||
}
|
||||
|
||||
@@ -129,8 +120,7 @@ public class JmsMessageHeaderAccessor extends NativeMessageHeaderAccessor {
|
||||
* @see JmsHeaders#TIMESTAMP
|
||||
*/
|
||||
@Override
|
||||
@Nullable
|
||||
public Long getTimestamp() {
|
||||
public @Nullable Long getTimestamp() {
|
||||
return (Long) getHeader(JmsHeaders.TIMESTAMP);
|
||||
}
|
||||
|
||||
|
||||
@@ -25,6 +25,7 @@ import jakarta.jms.QueueRequestor;
|
||||
import jakarta.jms.Session;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
import org.springframework.jms.InvalidClientIDException;
|
||||
import org.springframework.jms.InvalidDestinationException;
|
||||
@@ -39,7 +40,6 @@ import org.springframework.jms.ResourceAllocationException;
|
||||
import org.springframework.jms.TransactionInProgressException;
|
||||
import org.springframework.jms.TransactionRolledBackException;
|
||||
import org.springframework.jms.UncategorizedJmsException;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
/**
|
||||
@@ -241,8 +241,7 @@ public abstract class JmsUtils {
|
||||
* @return the descriptive message String
|
||||
* @see jakarta.jms.JMSException#getLinkedException()
|
||||
*/
|
||||
@Nullable
|
||||
public static String buildExceptionMessage(JMSException ex) {
|
||||
public static @Nullable String buildExceptionMessage(JMSException ex) {
|
||||
String message = ex.getMessage();
|
||||
Exception linkedEx = ex.getLinkedException();
|
||||
if (linkedEx != null) {
|
||||
|
||||
@@ -17,8 +17,7 @@
|
||||
package org.springframework.jms.support;
|
||||
|
||||
import jakarta.jms.Message;
|
||||
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
/**
|
||||
* Gather the Quality-of-Service settings that can be used when sending a message.
|
||||
|
||||
@@ -35,10 +35,10 @@ import jakarta.jms.JMSException;
|
||||
import jakarta.jms.Message;
|
||||
import jakarta.jms.Session;
|
||||
import jakarta.jms.TextMessage;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
import org.springframework.beans.factory.BeanClassLoaderAware;
|
||||
import org.springframework.core.MethodParameter;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.ClassUtils;
|
||||
|
||||
@@ -73,21 +73,17 @@ public class MappingJackson2MessageConverter implements SmartMessageConverter, B
|
||||
|
||||
private MessageType targetType = MessageType.BYTES;
|
||||
|
||||
@Nullable
|
||||
private String encoding;
|
||||
private @Nullable String encoding;
|
||||
|
||||
@Nullable
|
||||
private String encodingPropertyName;
|
||||
private @Nullable String encodingPropertyName;
|
||||
|
||||
@Nullable
|
||||
private String typeIdPropertyName;
|
||||
private @Nullable String typeIdPropertyName;
|
||||
|
||||
private Map<String, Class<?>> idClassMappings = new HashMap<>();
|
||||
|
||||
private final Map<Class<?>, String> classIdMappings = new HashMap<>();
|
||||
|
||||
@Nullable
|
||||
private ClassLoader beanClassLoader;
|
||||
private @Nullable ClassLoader beanClassLoader;
|
||||
|
||||
|
||||
/**
|
||||
@@ -478,8 +474,7 @@ public class MappingJackson2MessageConverter implements SmartMessageConverter, B
|
||||
* converter for the current conversion attempt
|
||||
* @return the serialization view class, or {@code null} if none
|
||||
*/
|
||||
@Nullable
|
||||
protected Class<?> getSerializationView(@Nullable Object conversionHint) {
|
||||
protected @Nullable Class<?> getSerializationView(@Nullable Object conversionHint) {
|
||||
if (conversionHint instanceof MethodParameter methodParam) {
|
||||
JsonView annotation = methodParam.getParameterAnnotation(JsonView.class);
|
||||
if (annotation == null) {
|
||||
|
||||
@@ -32,9 +32,9 @@ import jakarta.jms.JMSException;
|
||||
import jakarta.jms.Message;
|
||||
import jakarta.jms.Session;
|
||||
import jakarta.jms.TextMessage;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
import org.springframework.beans.factory.InitializingBean;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.oxm.Marshaller;
|
||||
import org.springframework.oxm.Unmarshaller;
|
||||
import org.springframework.oxm.XmlMappingException;
|
||||
@@ -52,11 +52,9 @@ import org.springframework.util.Assert;
|
||||
*/
|
||||
public class MarshallingMessageConverter implements MessageConverter, InitializingBean {
|
||||
|
||||
@Nullable
|
||||
private Marshaller marshaller;
|
||||
private @Nullable Marshaller marshaller;
|
||||
|
||||
@Nullable
|
||||
private Unmarshaller unmarshaller;
|
||||
private @Nullable Unmarshaller unmarshaller;
|
||||
|
||||
private MessageType targetType = MessageType.BYTES;
|
||||
|
||||
|
||||
@@ -16,8 +16,9 @@
|
||||
|
||||
package org.springframework.jms.support.converter;
|
||||
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
import org.springframework.jms.JmsException;
|
||||
import org.springframework.lang.Nullable;
|
||||
|
||||
/**
|
||||
* Thrown by {@link MessageConverter} implementations when the conversion
|
||||
|
||||
@@ -20,11 +20,11 @@ import java.util.Map;
|
||||
|
||||
import jakarta.jms.JMSException;
|
||||
import jakarta.jms.Session;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
import org.springframework.beans.factory.InitializingBean;
|
||||
import org.springframework.jms.support.JmsHeaderMapper;
|
||||
import org.springframework.jms.support.SimpleJmsHeaderMapper;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.messaging.Message;
|
||||
import org.springframework.messaging.MessageHeaders;
|
||||
import org.springframework.messaging.core.AbstractMessageSendingTemplate;
|
||||
|
||||
@@ -19,8 +19,7 @@ package org.springframework.jms.support.converter;
|
||||
import jakarta.jms.JMSException;
|
||||
import jakarta.jms.Message;
|
||||
import jakarta.jms.Session;
|
||||
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
/**
|
||||
* An extended {@link MessageConverter} SPI with conversion hint support.
|
||||
|
||||
@@ -2,9 +2,7 @@
|
||||
* Provides a MessageConverter abstraction to convert
|
||||
* between Java objects and JMS messages.
|
||||
*/
|
||||
@NonNullApi
|
||||
@NonNullFields
|
||||
@NullMarked
|
||||
package org.springframework.jms.support.converter;
|
||||
|
||||
import org.springframework.lang.NonNullApi;
|
||||
import org.springframework.lang.NonNullFields;
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
|
||||
@@ -19,11 +19,11 @@ package org.springframework.jms.support.destination;
|
||||
import jakarta.jms.Destination;
|
||||
import jakarta.jms.JMSException;
|
||||
import jakarta.jms.Session;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
import org.springframework.beans.BeansException;
|
||||
import org.springframework.beans.factory.BeanFactory;
|
||||
import org.springframework.beans.factory.BeanFactoryAware;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
/**
|
||||
@@ -38,8 +38,7 @@ import org.springframework.util.Assert;
|
||||
*/
|
||||
public class BeanFactoryDestinationResolver implements DestinationResolver, BeanFactoryAware {
|
||||
|
||||
@Nullable
|
||||
private BeanFactory beanFactory;
|
||||
private @Nullable BeanFactory beanFactory;
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@@ -16,8 +16,9 @@
|
||||
|
||||
package org.springframework.jms.support.destination;
|
||||
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
import org.springframework.jms.JmsException;
|
||||
import org.springframework.lang.Nullable;
|
||||
|
||||
/**
|
||||
* Thrown by a DestinationResolver when it cannot resolve a destination name.
|
||||
|
||||
@@ -19,8 +19,7 @@ package org.springframework.jms.support.destination;
|
||||
import jakarta.jms.Destination;
|
||||
import jakarta.jms.JMSException;
|
||||
import jakarta.jms.Session;
|
||||
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
/**
|
||||
* Strategy interface for resolving JMS destinations.
|
||||
|
||||
@@ -21,8 +21,8 @@ import jakarta.jms.JMSException;
|
||||
import jakarta.jms.Queue;
|
||||
import jakarta.jms.Session;
|
||||
import jakarta.jms.Topic;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
/**
|
||||
|
||||
@@ -21,9 +21,9 @@ import jakarta.jms.JMSException;
|
||||
import jakarta.jms.Message;
|
||||
import jakarta.jms.MessageConsumer;
|
||||
import jakarta.jms.Session;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
import org.springframework.jms.support.JmsAccessor;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
/**
|
||||
@@ -126,8 +126,7 @@ public abstract class JmsDestinationAccessor extends JmsAccessor {
|
||||
* @see #RECEIVE_TIMEOUT_NO_WAIT
|
||||
* @see #RECEIVE_TIMEOUT_INDEFINITE_WAIT
|
||||
*/
|
||||
@Nullable
|
||||
protected Message receiveFromConsumer(MessageConsumer consumer, long timeout) throws JMSException {
|
||||
protected @Nullable Message receiveFromConsumer(MessageConsumer consumer, long timeout) throws JMSException {
|
||||
if (timeout > 0) {
|
||||
return consumer.receive(timeout);
|
||||
}
|
||||
|
||||
@@ -26,9 +26,9 @@ import jakarta.jms.JMSException;
|
||||
import jakarta.jms.Queue;
|
||||
import jakarta.jms.Session;
|
||||
import jakarta.jms.Topic;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
import org.springframework.jndi.JndiLocatorSupport;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
/**
|
||||
* Support classes for Spring's JMS framework.
|
||||
*/
|
||||
@NonNullApi
|
||||
@NonNullFields
|
||||
@NullMarked
|
||||
package org.springframework.jms.support.destination;
|
||||
|
||||
import org.springframework.lang.NonNullApi;
|
||||
import org.springframework.lang.NonNullFields;
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
|
||||
@@ -2,9 +2,7 @@
|
||||
* This package provides generic JMS support classes,
|
||||
* to be used by higher-level classes like JmsTemplate.
|
||||
*/
|
||||
@NonNullApi
|
||||
@NonNullFields
|
||||
@NullMarked
|
||||
package org.springframework.jms.support;
|
||||
|
||||
import org.springframework.lang.NonNullApi;
|
||||
import org.springframework.lang.NonNullFields;
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
|
||||
@@ -19,6 +19,7 @@ package org.springframework.jms.annotation;
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
import jakarta.jms.JMSException;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.context.ApplicationContext;
|
||||
@@ -30,7 +31,6 @@ import org.springframework.jms.config.MethodJmsListenerEndpoint;
|
||||
import org.springframework.jms.config.SimpleJmsListenerEndpoint;
|
||||
import org.springframework.jms.listener.SimpleMessageListenerContainer;
|
||||
import org.springframework.jms.listener.adapter.MessagingMessageListenerAdapter;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.messaging.handler.annotation.SendTo;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.util.ReflectionUtils;
|
||||
|
||||
@@ -29,6 +29,7 @@ import jakarta.jms.ObjectMessage;
|
||||
import jakarta.jms.QueueSender;
|
||||
import jakarta.jms.Session;
|
||||
import jakarta.jms.TextMessage;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.TestInfo;
|
||||
@@ -47,7 +48,6 @@ import org.springframework.jms.support.JmsMessageHeaderAccessor;
|
||||
import org.springframework.jms.support.QosSettings;
|
||||
import org.springframework.jms.support.converter.MessageConverter;
|
||||
import org.springframework.jms.support.destination.DestinationResolver;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.messaging.Message;
|
||||
import org.springframework.messaging.MessageHeaders;
|
||||
import org.springframework.messaging.converter.MessageConversionException;
|
||||
|
||||
@@ -27,11 +27,11 @@ import jakarta.jms.Message;
|
||||
import jakarta.jms.MessageConsumer;
|
||||
import jakarta.jms.MessageListener;
|
||||
import jakarta.jms.Session;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.context.support.GenericApplicationContext;
|
||||
import org.springframework.jms.StubQueue;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.util.ErrorHandler;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
@@ -29,12 +29,12 @@ import jakarta.jms.BytesMessage;
|
||||
import jakarta.jms.JMSException;
|
||||
import jakarta.jms.Session;
|
||||
import jakarta.jms.TextMessage;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.mockito.stubbing.Answer;
|
||||
|
||||
import org.springframework.core.MethodParameter;
|
||||
import org.springframework.lang.Nullable;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException;
|
||||
|
||||
Reference in New Issue
Block a user