diff --git a/spring-jms/src/main/java/org/springframework/jms/core/JmsOperations.java b/spring-jms/src/main/java/org/springframework/jms/core/JmsOperations.java index 58cadaa7de9..ffd42aad4ac 100644 --- a/spring-jms/src/main/java/org/springframework/jms/core/JmsOperations.java +++ b/spring-jms/src/main/java/org/springframework/jms/core/JmsOperations.java @@ -239,7 +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(@Nullable String messageSelector) throws JmsException; /** * Receive a message synchronously from the specified destination, but only @@ -252,7 +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, @Nullable String messageSelector) throws JmsException; /** * Receive a message synchronously from the specified destination, but only @@ -266,7 +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, @Nullable String messageSelector) throws JmsException; //--------------------------------------------------------------------------------------- @@ -322,7 +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(@Nullable String messageSelector) throws JmsException; /** * Receive a message synchronously from the specified destination, but only @@ -336,7 +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, @Nullable String messageSelector) throws JmsException; /** * Receive a message synchronously from the specified destination, but only @@ -351,7 +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, @Nullable String messageSelector) throws JmsException; //--------------------------------------------------------------------------------------- @@ -445,7 +445,7 @@ public interface JmsOperations { * @return the result object from working with the session * @throws JmsException checked JMSException converted to unchecked */ - @Nullable T browseSelected(String messageSelector, BrowserCallback action) throws JmsException; + @Nullable T browseSelected(@Nullable String messageSelector, BrowserCallback action) throws JmsException; /** * Browse selected messages in a JMS queue. The callback gives access to the JMS @@ -457,7 +457,7 @@ public interface JmsOperations { * @return the result object from working with the session * @throws JmsException checked JMSException converted to unchecked */ - @Nullable T browseSelected(Queue queue, String messageSelector, BrowserCallback action) throws JmsException; + @Nullable T browseSelected(Queue queue, @Nullable String messageSelector, BrowserCallback action) throws JmsException; /** * Browse selected messages in a JMS queue. The callback gives access to the JMS @@ -470,6 +470,6 @@ public interface JmsOperations { * @return the result object from working with the session * @throws JmsException checked JMSException converted to unchecked */ - @Nullable T browseSelected(String queueName, String messageSelector, BrowserCallback action) throws JmsException; + @Nullable T browseSelected(String queueName, @Nullable String messageSelector, BrowserCallback action) throws JmsException; } diff --git a/spring-jms/src/main/java/org/springframework/jms/core/JmsTemplate.java b/spring-jms/src/main/java/org/springframework/jms/core/JmsTemplate.java index 32d6c8c2545..efa1c866dbf 100644 --- a/spring-jms/src/main/java/org/springframework/jms/core/JmsTemplate.java +++ b/spring-jms/src/main/java/org/springframework/jms/core/JmsTemplate.java @@ -541,7 +541,7 @@ public class JmsTemplate extends JmsDestinationAccessor implements JmsOperations } @Override - public @Nullable T execute(final @Nullable Destination destination, final ProducerCallback action) throws JmsException { + public @Nullable T execute(@Nullable Destination destination, ProducerCallback action) throws JmsException { Assert.notNull(action, "Callback object must not be null"); return execute(session -> { MessageProducer producer = createProducer(session, destination); @@ -555,7 +555,7 @@ public class JmsTemplate extends JmsDestinationAccessor implements JmsOperations } @Override - public @Nullable T execute(final String destinationName, final ProducerCallback action) throws JmsException { + public @Nullable T execute(String destinationName, ProducerCallback action) throws JmsException { Assert.notNull(action, "Callback object must not be null"); return execute(session -> { Destination destination = resolveDestinationName(session, destinationName); @@ -586,7 +586,7 @@ public class JmsTemplate extends JmsDestinationAccessor implements JmsOperations } @Override - public void send(final Destination destination, final MessageCreator messageCreator) throws JmsException { + public void send(Destination destination, MessageCreator messageCreator) throws JmsException { execute(session -> { doSend(session, destination, messageCreator); return null; @@ -594,7 +594,7 @@ public class JmsTemplate extends JmsDestinationAccessor implements JmsOperations } @Override - public void send(final String destinationName, final MessageCreator messageCreator) throws JmsException { + public void send(String destinationName, MessageCreator messageCreator) throws JmsException { execute(session -> { Destination destination = resolveDestinationName(session, destinationName); doSend(session, destination, messageCreator); @@ -666,12 +666,12 @@ public class JmsTemplate extends JmsDestinationAccessor implements JmsOperations } @Override - public void convertAndSend(Destination destination, final Object message) throws JmsException { + public void convertAndSend(Destination destination, Object message) throws JmsException { send(destination, session -> getRequiredMessageConverter().toMessage(message, session)); } @Override - public void convertAndSend(String destinationName, final Object message) throws JmsException { + public void convertAndSend(String destinationName, Object message) throws JmsException { send(destinationName, session -> getRequiredMessageConverter().toMessage(message, session)); } @@ -688,7 +688,7 @@ public class JmsTemplate extends JmsDestinationAccessor implements JmsOperations @Override public void convertAndSend( - Destination destination, final Object message, final MessagePostProcessor postProcessor) + Destination destination, Object message, MessagePostProcessor postProcessor) throws JmsException { send(destination, session -> { @@ -699,7 +699,7 @@ public class JmsTemplate extends JmsDestinationAccessor implements JmsOperations @Override public void convertAndSend( - String destinationName, final Object message, final MessagePostProcessor postProcessor) + String destinationName, Object message, MessagePostProcessor postProcessor) throws JmsException { send(destinationName, session -> { @@ -735,7 +735,7 @@ public class JmsTemplate extends JmsDestinationAccessor implements JmsOperations } @Override - public @Nullable Message receiveSelected(String messageSelector) throws JmsException { + public @Nullable Message receiveSelected(@Nullable String messageSelector) throws JmsException { Destination defaultDestination = getDefaultDestination(); if (defaultDestination != null) { return receiveSelected(defaultDestination, messageSelector); @@ -746,12 +746,12 @@ public class JmsTemplate extends JmsDestinationAccessor implements JmsOperations } @Override - public @Nullable Message receiveSelected(final Destination destination, final @Nullable String messageSelector) throws JmsException { + public @Nullable Message receiveSelected(Destination destination, @Nullable String messageSelector) throws JmsException { return execute(session -> doReceive(session, destination, messageSelector), true); } @Override - public @Nullable Message receiveSelected(final String destinationName, final @Nullable String messageSelector) throws JmsException { + public @Nullable Message receiveSelected(String destinationName, @Nullable String messageSelector) throws JmsException { return execute(session -> { Destination destination = resolveDestinationName(session, destinationName); return doReceive(session, destination, messageSelector); @@ -833,17 +833,17 @@ public class JmsTemplate extends JmsDestinationAccessor implements JmsOperations } @Override - public @Nullable Object receiveSelectedAndConvert(String messageSelector) throws JmsException { + public @Nullable Object receiveSelectedAndConvert(@Nullable String messageSelector) throws JmsException { return doConvertFromMessage(receiveSelected(messageSelector)); } @Override - public @Nullable Object receiveSelectedAndConvert(Destination destination, String messageSelector) throws JmsException { + public @Nullable Object receiveSelectedAndConvert(Destination destination, @Nullable String messageSelector) throws JmsException { return doConvertFromMessage(receiveSelected(destination, messageSelector)); } @Override - public @Nullable Object receiveSelectedAndConvert(String destinationName, String messageSelector) throws JmsException { + public @Nullable Object receiveSelectedAndConvert(String destinationName, @Nullable String messageSelector) throws JmsException { return doConvertFromMessage(receiveSelected(destinationName, messageSelector)); } @@ -881,12 +881,12 @@ public class JmsTemplate extends JmsDestinationAccessor implements JmsOperations } @Override - public @Nullable Message sendAndReceive(final Destination destination, final MessageCreator messageCreator) throws JmsException { + public @Nullable Message sendAndReceive(Destination destination, MessageCreator messageCreator) throws JmsException { return executeLocal(session -> doSendAndReceive(session, destination, messageCreator), true); } @Override - public @Nullable Message sendAndReceive(final String destinationName, final MessageCreator messageCreator) throws JmsException { + public @Nullable Message sendAndReceive(String destinationName, MessageCreator messageCreator) throws JmsException { return executeLocal(session -> { Destination destination = resolveDestinationName(session, destinationName); return doSendAndReceive(session, destination, messageCreator); @@ -986,7 +986,7 @@ public class JmsTemplate extends JmsDestinationAccessor implements JmsOperations } @Override - public @Nullable T browseSelected(String messageSelector, BrowserCallback action) throws JmsException { + public @Nullable T browseSelected(@Nullable String messageSelector, BrowserCallback action) throws JmsException { Queue defaultQueue = getDefaultQueue(); if (defaultQueue != null) { return browseSelected(defaultQueue, messageSelector, action); @@ -997,7 +997,7 @@ public class JmsTemplate extends JmsDestinationAccessor implements JmsOperations } @Override - public @Nullable T browseSelected(final Queue queue, final @Nullable String messageSelector, final BrowserCallback action) + public @Nullable T browseSelected(Queue queue, @Nullable String messageSelector, BrowserCallback action) throws JmsException { Assert.notNull(action, "Callback object must not be null"); @@ -1013,7 +1013,7 @@ public class JmsTemplate extends JmsDestinationAccessor implements JmsOperations } @Override - public @Nullable T browseSelected(final String queueName, final @Nullable String messageSelector, final BrowserCallback action) + public @Nullable T browseSelected(String queueName, @Nullable String messageSelector, BrowserCallback action) throws JmsException { Assert.notNull(action, "Callback object must not be null");