diff --git a/spring-context-support/src/main/java/org/springframework/cache/jcache/config/JCacheConfigurer.java b/spring-context-support/src/main/java/org/springframework/cache/jcache/config/JCacheConfigurer.java index 821d2e6b2e9..784a42ae15d 100644 --- a/spring-context-support/src/main/java/org/springframework/cache/jcache/config/JCacheConfigurer.java +++ b/spring-context-support/src/main/java/org/springframework/cache/jcache/config/JCacheConfigurer.java @@ -23,14 +23,14 @@ import org.springframework.cache.interceptor.CacheResolver; * Extension of {@link CachingConfigurer} for the JSR-107 implementation. * *

To be implemented by classes annotated with - * @{@link org.springframework.cache.annotation.EnableCaching} that wish or - * need to specify explicitly how exception caches are resolved for + * {@link org.springframework.cache.annotation.EnableCaching} that wish + * or need to specify explicitly how exception caches are resolved for * annotation-driven cache management. Consider extending {@link JCacheConfigurerSupport}, * which provides a stub implementation of all interface methods. * - *

See @{@link org.springframework.cache.annotation.EnableCaching} for - * general examples and context; see {@link #exceptionCacheResolver()} for detailed - * instructions. + *

See {@link org.springframework.cache.annotation.EnableCaching} for + * general examples and context; see {@link #exceptionCacheResolver()} for + * detailed instructions. * * @author Stephane Nicoll * @since 4.1 diff --git a/spring-context-support/src/main/java/org/springframework/cache/jcache/interceptor/JCacheAspectSupport.java b/spring-context-support/src/main/java/org/springframework/cache/jcache/interceptor/JCacheAspectSupport.java index b6a4c881a39..c3b0b2e3204 100644 --- a/spring-context-support/src/main/java/org/springframework/cache/jcache/interceptor/JCacheAspectSupport.java +++ b/spring-context-support/src/main/java/org/springframework/cache/jcache/interceptor/JCacheAspectSupport.java @@ -69,6 +69,7 @@ public class JCacheAspectSupport extends AbstractCacheInvoker implements Initial private CacheRemoveAllInterceptor cacheRemoveAllInterceptor; + public void setCacheOperationSource(JCacheOperationSource cacheOperationSource) { Assert.notNull(cacheOperationSource); this.cacheOperationSource = cacheOperationSource; @@ -158,9 +159,8 @@ public class JCacheAspectSupport extends AbstractCacheInvoker implements Initial /** * Execute the underlying operation (typically in case of cache miss) and return * the result of the invocation. If an exception occurs it will be wrapped in - * a {@link CacheOperationInvoker.ThrowableWrapper}: the exception can be handled - * or modified but it must be wrapped in a - * {@link CacheOperationInvoker.ThrowableWrapper} as well. + * a {@code ThrowableWrapper}: the exception can be handled or modified but it + * must be wrapped in a {@code ThrowableWrapper} as well. * @param invoker the invoker handling the operation being cached * @return the result of the invocation * @see CacheOperationInvoker#invoke() @@ -169,15 +169,18 @@ public class JCacheAspectSupport extends AbstractCacheInvoker implements Initial return invoker.invoke(); } + private class CacheOperationInvokerAdapter implements CacheOperationInvoker { private final CacheOperationInvoker delegate; - private CacheOperationInvokerAdapter(CacheOperationInvoker delegate) {this.delegate = delegate;} + public CacheOperationInvokerAdapter(CacheOperationInvoker delegate) { + this.delegate = delegate; + } @Override public Object invoke() throws ThrowableWrapper { - return invokeOperation(delegate); + return invokeOperation(this.delegate); } } diff --git a/spring-context-support/src/main/java/org/springframework/cache/jcache/interceptor/SimpleCacheKeyGenerator.java b/spring-context-support/src/main/java/org/springframework/cache/jcache/interceptor/SimpleCacheKeyGenerator.java index 81d27693e2e..cc020dd3163 100644 --- a/spring-context-support/src/main/java/org/springframework/cache/jcache/interceptor/SimpleCacheKeyGenerator.java +++ b/spring-context-support/src/main/java/org/springframework/cache/jcache/interceptor/SimpleCacheKeyGenerator.java @@ -1,3 +1,19 @@ +/* + * Copyright 2002-2014 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package org.springframework.cache.jcache.interceptor; import java.lang.annotation.Annotation; @@ -13,7 +29,7 @@ import javax.cache.annotation.GeneratedCacheKey; * the {@link javax.cache.annotation.CacheValue} one. * * @author Stephane Nicoll - * @see 4.1 + * @since 4.1 * @see javax.cache.annotation.CacheKeyInvocationContext#getKeyParameters() */ public class SimpleCacheKeyGenerator implements CacheKeyGenerator { diff --git a/spring-context-support/src/main/java/org/springframework/cache/jcache/model/CacheResultOperation.java b/spring-context-support/src/main/java/org/springframework/cache/jcache/model/CacheResultOperation.java index fbc2e654fc4..777f2a9c709 100644 --- a/spring-context-support/src/main/java/org/springframework/cache/jcache/model/CacheResultOperation.java +++ b/spring-context-support/src/main/java/org/springframework/cache/jcache/model/CacheResultOperation.java @@ -21,8 +21,8 @@ import javax.cache.annotation.CacheResult; import org.springframework.cache.interceptor.CacheResolver; import org.springframework.cache.interceptor.KeyGenerator; -import org.springframework.util.StringUtils; import org.springframework.util.ExceptionTypeFilter; +import org.springframework.util.StringUtils; /** * The {@link JCacheOperation} implementation for a {@link CacheResult} operation. @@ -47,8 +47,7 @@ public class CacheResultOperation extends BaseKeyCacheOperation { CacheResult ann = methodDetails.getCacheAnnotation(); this.exceptionTypeFilter = createExceptionTypeFilter(ann.cachedExceptions(), ann.nonCachedExceptions()); this.exceptionCacheResolver = exceptionCacheResolver; - String exceptionCacheNameCandidate = ann.exceptionCacheName(); - this.exceptionCacheName = StringUtils.hasText(exceptionCacheNameCandidate) ? exceptionCacheNameCandidate : null; + this.exceptionCacheName = (StringUtils.hasText(ann.exceptionCacheName()) ? ann.exceptionCacheName() : null); } @@ -58,8 +57,8 @@ public class CacheResultOperation extends BaseKeyCacheOperation { } /** - * Specify if the method should always be invoked regardless of a cache hit. By - * default, the method is only invoked in case of a cache miss. + * Specify if the method should always be invoked regardless of a cache hit. + * By default, the method is only invoked in case of a cache miss. * @see javax.cache.annotation.CacheResult#skipGet() */ public boolean isAlwaysInvoked() { @@ -75,7 +74,7 @@ public class CacheResultOperation extends BaseKeyCacheOperation { } /** - * Return the name of the cache to cache exceptions. Return {@link null} if + * Return the name of the cache to cache exceptions, or {@code null} if * caching exceptions should be disabled. * @see javax.cache.annotation.CacheResult#exceptionCacheName() */ diff --git a/spring-context-support/src/main/java/org/springframework/scheduling/quartz/SchedulerFactoryBean.java b/spring-context-support/src/main/java/org/springframework/scheduling/quartz/SchedulerFactoryBean.java index 69282efcbf9..fe4bf54cdd9 100644 --- a/spring-context-support/src/main/java/org/springframework/scheduling/quartz/SchedulerFactoryBean.java +++ b/spring-context-support/src/main/java/org/springframework/scheduling/quartz/SchedulerFactoryBean.java @@ -310,7 +310,7 @@ public class SchedulerFactoryBean extends SchedulerAccessor implements FactoryBe * reference into the JobDataMap but rather into the SchedulerContext. * @param schedulerContextAsMap Map with String keys and any objects as * values (for example Spring-managed beans) - * @see JobDetailBean#setJobDataAsMap + * @see JobDetailFactoryBean#setJobDataAsMap */ public void setSchedulerContextAsMap(Map schedulerContextAsMap) { this.schedulerContextMap = schedulerContextAsMap; @@ -328,8 +328,8 @@ public class SchedulerFactoryBean extends SchedulerAccessor implements FactoryBe * correspond to a "setApplicationContext" method in that scenario. *

Note that BeanFactory callback interfaces like ApplicationContextAware * are not automatically applied to Quartz Job instances, because Quartz - * itself is reponsible for the lifecycle of its Jobs. - * @see JobDetailBean#setApplicationContextJobDataKey + * itself is responsible for the lifecycle of its Jobs. + * @see JobDetailFactoryBean#setApplicationContextJobDataKey * @see org.springframework.context.ApplicationContext */ public void setApplicationContextSchedulerContextKey(String applicationContextSchedulerContextKey) { diff --git a/spring-messaging/src/main/java/org/springframework/messaging/simp/annotation/support/SubscriptionMethodReturnValueHandler.java b/spring-messaging/src/main/java/org/springframework/messaging/simp/annotation/support/SubscriptionMethodReturnValueHandler.java index 6f686795394..aa86dbc3c29 100644 --- a/spring-messaging/src/main/java/org/springframework/messaging/simp/annotation/support/SubscriptionMethodReturnValueHandler.java +++ b/spring-messaging/src/main/java/org/springframework/messaging/simp/annotation/support/SubscriptionMethodReturnValueHandler.java @@ -18,6 +18,7 @@ package org.springframework.messaging.simp.annotation.support; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; + import org.springframework.core.MethodParameter; import org.springframework.messaging.Message; import org.springframework.messaging.MessageHeaders; @@ -56,20 +57,19 @@ public class SubscriptionMethodReturnValueHandler implements HandlerMethodReturn /** - * Class constructor. - * - * @param messagingTemplate a messaging template to send messages to, most - * likely the "clientOutboundChannel", must not be {@link null}. + * Construct a new SubscriptionMethodReturnValueHandler. + * @param messagingTemplate a messaging template to send messages to, + * most likely the "clientOutboundChannel" (must not be {@code null}) */ public SubscriptionMethodReturnValueHandler(MessageSendingOperations messagingTemplate) { Assert.notNull(messagingTemplate, "messagingTemplate must not be null"); this.messagingTemplate = messagingTemplate; } + /** * Configure a {@link MessageHeaderInitializer} to apply to the headers of all * messages sent to the client outbound channel. - * *

By default this property is not set. */ public void setHeaderInitializer(MessageHeaderInitializer headerInitializer) { @@ -77,7 +77,7 @@ public class SubscriptionMethodReturnValueHandler implements HandlerMethodReturn } /** - * @return the configured header initializer. + * Return the configured header initializer. */ public MessageHeaderInitializer getHeaderInitializer() { return this.headerInitializer; @@ -86,9 +86,9 @@ public class SubscriptionMethodReturnValueHandler implements HandlerMethodReturn @Override public boolean supportsReturnType(MethodParameter returnType) { - return ((returnType.getMethodAnnotation(SubscribeMapping.class) != null) - && (returnType.getMethodAnnotation(SendTo.class) == null) - && (returnType.getMethodAnnotation(SendToUser.class) == null)); + return (returnType.getMethodAnnotation(SubscribeMapping.class) != null && + returnType.getMethodAnnotation(SendTo.class) == null && + returnType.getMethodAnnotation(SendToUser.class) == null); } @Override @@ -96,6 +96,7 @@ public class SubscriptionMethodReturnValueHandler implements HandlerMethodReturn if (returnValue == null) { return; } + MessageHeaders headers = message.getHeaders(); String destination = SimpMessageHeaderAccessor.getDestination(headers); String sessionId = SimpMessageHeaderAccessor.getSessionId(headers); diff --git a/spring-messaging/src/main/java/org/springframework/messaging/simp/broker/AbstractBrokerMessageHandler.java b/spring-messaging/src/main/java/org/springframework/messaging/simp/broker/AbstractBrokerMessageHandler.java index a6e91526588..c37bcda17c0 100644 --- a/spring-messaging/src/main/java/org/springframework/messaging/simp/broker/AbstractBrokerMessageHandler.java +++ b/spring-messaging/src/main/java/org/springframework/messaging/simp/broker/AbstractBrokerMessageHandler.java @@ -39,7 +39,7 @@ import org.springframework.util.CollectionUtils; * @since 4.0 */ public abstract class AbstractBrokerMessageHandler - implements MessageHandler, SmartLifecycle, ApplicationEventPublisherAware { + implements MessageHandler, ApplicationEventPublisherAware, SmartLifecycle { protected final Log logger = LogFactory.getLog(getClass()); @@ -56,10 +56,10 @@ public abstract class AbstractBrokerMessageHandler private boolean autoStartup = true; - private Object lifecycleMonitor = new Object(); - private volatile boolean running = false; + private final Object lifecycleMonitor = new Object(); + public AbstractBrokerMessageHandler() { this(Collections.emptyList()); @@ -100,7 +100,6 @@ public abstract class AbstractBrokerMessageHandler /** * Check whether this message handler is currently running. - * *

Note that even when this message handler is running the * {@link #isBrokerAvailable()} flag may still independently alternate between * being on and off depending on the concrete sub-class implementation. @@ -112,23 +111,6 @@ public abstract class AbstractBrokerMessageHandler } } - /** - * Whether the message broker is currently available and able to process messages. - * - *

Note that this is in addition to the {@link #isRunning()} flag, which - * indicates whether this message handler is running. In other words the message - * handler must first be running and then the {@link #isBrokerAvailable()} flag - * may still independently alternate between being on and off depending on the - * concrete sub-class implementation. - * - *

Application components may implement - * {@link org.springframework.context.ApplicationListener>} - * to receive notifications when broker becomes available and unavailable. - */ - public boolean isBrokerAvailable() { - return this.brokerAvailable.get(); - } - @Override public void start() { synchronized (this.lifecycleMonitor) { @@ -171,6 +153,22 @@ public abstract class AbstractBrokerMessageHandler } } + /** + * Whether the message broker is currently available and able to process messages. + *

Note that this is in addition to the {@link #isRunning()} flag, which + * indicates whether this message handler is running. In other words the message + * handler must first be running and then the {@code #isBrokerAvailable()} flag + * may still independently alternate between being on and off depending on the + * concrete sub-class implementation. + *

Application components may implement + * {@code org.springframework.context.ApplicationListener<BrokerAvailabilityEvent>} + * to receive notifications when broker becomes available and unavailable. + */ + public boolean isBrokerAvailable() { + return this.brokerAvailable.get(); + } + + @Override public void handleMessage(Message message) { if (!this.running) { diff --git a/spring-messaging/src/main/java/org/springframework/messaging/support/IdTimestampMessageHeaderInitializer.java b/spring-messaging/src/main/java/org/springframework/messaging/support/IdTimestampMessageHeaderInitializer.java index c5780c19d60..abd5af665ef 100644 --- a/spring-messaging/src/main/java/org/springframework/messaging/support/IdTimestampMessageHeaderInitializer.java +++ b/spring-messaging/src/main/java/org/springframework/messaging/support/IdTimestampMessageHeaderInitializer.java @@ -40,7 +40,7 @@ public class IdTimestampMessageHeaderInitializer implements MessageHeaderInitial * instances with. *

By default this property is set to {@code null} in which case the default * IdGenerator of {@link org.springframework.messaging.MessageHeaders} is used. - *

To have no id's generated at all, see {@@link #setDisableIdGeneration()}. + *

To have no id's generated at all, see {@link #setDisableIdGeneration()}. */ public void setIdGenerator(IdGenerator idGenerator) { this.idGenerator = idGenerator; diff --git a/spring-web/src/main/java/org/springframework/http/converter/json/Jackson2ObjectMapperFactoryBean.java b/spring-web/src/main/java/org/springframework/http/converter/json/Jackson2ObjectMapperFactoryBean.java index 9e6933f6dee..19abe082e6b 100644 --- a/spring-web/src/main/java/org/springframework/http/converter/json/Jackson2ObjectMapperFactoryBean.java +++ b/spring-web/src/main/java/org/springframework/http/converter/json/Jackson2ObjectMapperFactoryBean.java @@ -341,7 +341,7 @@ public class Jackson2ObjectMapperFactoryBean implements FactoryBeanOverride it to use a different initializer. * @see org.apache.tiles.web.startup.AbstractTilesListener#createTilesInitializer() */