From ad55687627e34a6b7d9d2917bc749406cf69c82d Mon Sep 17 00:00:00 2001 From: Juergen Hoeller Date: Thu, 11 Jun 2015 12:33:30 +0200 Subject: [PATCH] Polishing --- .../jms/connection/CachedMessageProducer.java | 4 +++- .../jms/connection/CachingConnectionFactory.java | 4 +++- .../org/springframework/jms/core/JmsTemplate.java | 3 ++- .../listener/AbstractMessageListenerContainer.java | 2 ++ .../web/context/request/WebRequest.java | 1 - .../request/async/NoSupportAsyncWebRequest.java | 4 +++- .../async/StandardServletAsyncWebRequest.java | 12 +++++++----- 7 files changed, 20 insertions(+), 10 deletions(-) diff --git a/spring-jms/src/main/java/org/springframework/jms/connection/CachedMessageProducer.java b/spring-jms/src/main/java/org/springframework/jms/connection/CachedMessageProducer.java index 6d234c2a8a..3d7e0fb5f1 100644 --- a/spring-jms/src/main/java/org/springframework/jms/connection/CachedMessageProducer.java +++ b/spring-jms/src/main/java/org/springframework/jms/connection/CachedMessageProducer.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2014 the original author or authors. + * Copyright 2002-2015 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -41,6 +41,8 @@ import org.springframework.util.ReflectionUtils; */ class CachedMessageProducer implements MessageProducer, QueueSender, TopicPublisher { + // Various JMS 2.0 MessageProducer methods, if available + private static final Method setDeliveryDelayMethod = ClassUtils.getMethodIfAvailable(MessageProducer.class, "setDeliveryDelay", long.class); diff --git a/spring-jms/src/main/java/org/springframework/jms/connection/CachingConnectionFactory.java b/spring-jms/src/main/java/org/springframework/jms/connection/CachingConnectionFactory.java index 8c4d8f592f..2708e0d772 100644 --- a/spring-jms/src/main/java/org/springframework/jms/connection/CachingConnectionFactory.java +++ b/spring-jms/src/main/java/org/springframework/jms/connection/CachingConnectionFactory.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2014 the original author or authors. + * Copyright 2002-2015 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -78,9 +78,11 @@ import org.springframework.util.ReflectionUtils; */ public class CachingConnectionFactory extends SingleConnectionFactory { + /** The JMS 2.0 Session.createSharedConsumer method, if available */ private static final Method createSharedConsumerMethod = ClassUtils.getMethodIfAvailable( Session.class, "createSharedConsumer", Topic.class, String.class, String.class); + /** The JMS 2.0 Session.createSharedDurableConsumer method, if available */ private static final Method createSharedDurableConsumerMethod = ClassUtils.getMethodIfAvailable( Session.class, "createSharedDurableConsumer", Topic.class, String.class, String.class); 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 8ae419c502..3013d7ef84 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 @@ -1,5 +1,5 @@ /* - * Copyright 2002-2014 the original author or authors. + * Copyright 2002-2015 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -101,6 +101,7 @@ public class JmsTemplate extends JmsDestinationAccessor implements JmsOperations public static final long RECEIVE_TIMEOUT_INDEFINITE_WAIT = 0; + /** The JMS 2.0 MessageProducer.setDeliveryDelay method, if available */ private static final Method setDeliveryDelayMethod = ClassUtils.getMethodIfAvailable(MessageProducer.class, "setDeliveryDelay", long.class); diff --git a/spring-jms/src/main/java/org/springframework/jms/listener/AbstractMessageListenerContainer.java b/spring-jms/src/main/java/org/springframework/jms/listener/AbstractMessageListenerContainer.java index 8af2b21418..d2b5cf787d 100644 --- a/spring-jms/src/main/java/org/springframework/jms/listener/AbstractMessageListenerContainer.java +++ b/spring-jms/src/main/java/org/springframework/jms/listener/AbstractMessageListenerContainer.java @@ -134,9 +134,11 @@ import org.springframework.util.ReflectionUtils; public abstract class AbstractMessageListenerContainer extends AbstractJmsListeningContainer implements MessageListenerContainer { + /** The JMS 2.0 Session.createSharedConsumer method, if available */ private static final Method createSharedConsumerMethod = ClassUtils.getMethodIfAvailable( Session.class, "createSharedConsumer", Topic.class, String.class, String.class); + /** The JMS 2.0 Session.createSharedDurableConsumer method, if available */ private static final Method createSharedDurableConsumerMethod = ClassUtils.getMethodIfAvailable( Session.class, "createSharedDurableConsumer", Topic.class, String.class, String.class); diff --git a/spring-web/src/main/java/org/springframework/web/context/request/WebRequest.java b/spring-web/src/main/java/org/springframework/web/context/request/WebRequest.java index 6a9d6bb547..68f3debf6a 100644 --- a/spring-web/src/main/java/org/springframework/web/context/request/WebRequest.java +++ b/spring-web/src/main/java/org/springframework/web/context/request/WebRequest.java @@ -221,7 +221,6 @@ public interface WebRequest extends RequestAttributes { * @return whether the request qualifies as not modified, * allowing to abort request processing and relying on the response * telling the client that the content has not been modified - * * @since 4.2 */ boolean checkNotModified(String etag, long lastModifiedTimestamp); diff --git a/spring-web/src/main/java/org/springframework/web/context/request/async/NoSupportAsyncWebRequest.java b/spring-web/src/main/java/org/springframework/web/context/request/async/NoSupportAsyncWebRequest.java index 5fa0f94a79..c9797cd53b 100644 --- a/spring-web/src/main/java/org/springframework/web/context/request/async/NoSupportAsyncWebRequest.java +++ b/spring-web/src/main/java/org/springframework/web/context/request/async/NoSupportAsyncWebRequest.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2015 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -33,6 +33,7 @@ public class NoSupportAsyncWebRequest extends ServletWebRequest implements Async super(request, response); } + @Override public void addCompletionHandler(Runnable runnable) { // ignored @@ -53,6 +54,7 @@ public class NoSupportAsyncWebRequest extends ServletWebRequest implements Async return false; } + // Not supported @Override diff --git a/spring-web/src/main/java/org/springframework/web/context/request/async/StandardServletAsyncWebRequest.java b/spring-web/src/main/java/org/springframework/web/context/request/async/StandardServletAsyncWebRequest.java index ff94a75217..a8878e998c 100644 --- a/spring-web/src/main/java/org/springframework/web/context/request/async/StandardServletAsyncWebRequest.java +++ b/spring-web/src/main/java/org/springframework/web/context/request/async/StandardServletAsyncWebRequest.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2015 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -35,7 +35,7 @@ import org.springframework.web.context.request.ServletWebRequest; *

The servlet and all filters involved in an async request must have async * support enabled using the Servlet API or by adding an * {@code true} element to servlet and filter - * declarations in web.xml + * declarations in {@code web.xml}. * * @author Rossen Stoyanchev * @since 3.2 @@ -62,9 +62,9 @@ public class StandardServletAsyncWebRequest extends ServletWebRequest implements super(request, response); } + /** - * {@inheritDoc} - *

In Servlet 3 async processing, the timeout period begins after the + * In Servlet 3 async processing, the timeout period begins after the * container processing thread has exited. */ @Override @@ -85,7 +85,7 @@ public class StandardServletAsyncWebRequest extends ServletWebRequest implements @Override public boolean isAsyncStarted() { - return ((this.asyncContext != null) && getRequest().isAsyncStarted()); + return (this.asyncContext != null && getRequest().isAsyncStarted()); } /** @@ -106,6 +106,7 @@ public class StandardServletAsyncWebRequest extends ServletWebRequest implements "or by adding \"true\" to servlet and " + "filter declarations in web.xml."); Assert.state(!isAsyncComplete(), "Async processing has already completed"); + if (isAsyncStarted()) { return; } @@ -122,6 +123,7 @@ public class StandardServletAsyncWebRequest extends ServletWebRequest implements this.asyncContext.dispatch(); } + // --------------------------------------------------------------------- // Implementation of AsyncListener methods // ---------------------------------------------------------------------