Polishing
This commit is contained in:
parent
e566e25b6f
commit
a9ae2c3402
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
* Copyright 2002-2017 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.
|
||||
|
@ -180,9 +180,9 @@ public class ConcurrentMapCache extends AbstractValueAdaptingCache {
|
|||
try {
|
||||
return serializeValue(storeValue);
|
||||
}
|
||||
catch (Exception ex) {
|
||||
throw new IllegalArgumentException("Failed to serialize cache value '"
|
||||
+ userValue + "'. Does it implement Serializable?", ex);
|
||||
catch (Throwable ex) {
|
||||
throw new IllegalArgumentException("Failed to serialize cache value '" + userValue +
|
||||
"'. Does it implement Serializable?", ex);
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
@ -207,9 +207,8 @@ public class ConcurrentMapCache extends AbstractValueAdaptingCache {
|
|||
try {
|
||||
return super.fromStoreValue(deserializeValue(storeValue));
|
||||
}
|
||||
catch (Exception ex) {
|
||||
throw new IllegalArgumentException("Failed to deserialize cache value '" +
|
||||
storeValue + "'", ex);
|
||||
catch (Throwable ex) {
|
||||
throw new IllegalArgumentException("Failed to deserialize cache value '" + storeValue + "'", ex);
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2014 the original author or authors.
|
||||
* Copyright 2002-2017 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.
|
||||
|
@ -22,12 +22,12 @@ 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.util.Assert;
|
||||
|
||||
/**
|
||||
* Base model for a JMS listener endpoint
|
||||
*
|
||||
* @author Stephane Nicoll
|
||||
* @author Juergen Hoeller
|
||||
* @since 4.1
|
||||
* @see MethodJmsListenerEndpoint
|
||||
* @see SimpleJmsListenerEndpoint
|
||||
|
@ -150,7 +150,9 @@ public abstract class AbstractJmsListenerEndpoint implements JmsListenerEndpoint
|
|||
|
||||
private void setupMessageListener(MessageListenerContainer container) {
|
||||
MessageListener messageListener = createMessageListener(container);
|
||||
Assert.state(messageListener != null, "Endpoint [" + this + "] must provide a non null message listener");
|
||||
if (messageListener == null) {
|
||||
throw new IllegalStateException("Endpoint [" + this + "] must provide a non-null message listener");
|
||||
}
|
||||
container.setupMessageListener(messageListener);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
* Copyright 2002-2017 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.
|
||||
|
@ -117,8 +117,7 @@ public class JmsListenerEndpointRegistrar implements BeanFactoryAware, Initializ
|
|||
public void setBeanFactory(BeanFactory beanFactory) {
|
||||
this.beanFactory = beanFactory;
|
||||
if (beanFactory instanceof ConfigurableBeanFactory) {
|
||||
ConfigurableBeanFactory cbf = (ConfigurableBeanFactory) beanFactory;
|
||||
this.mutex = cbf.getSingletonMutex();
|
||||
this.mutex = ((ConfigurableBeanFactory) beanFactory).getSingletonMutex();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
* Copyright 2002-2017 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.
|
||||
|
@ -57,8 +57,6 @@ public class MethodJmsListenerEndpoint extends AbstractJmsListenerEndpoint imple
|
|||
|
||||
private StringValueResolver embeddedValueResolver;
|
||||
|
||||
private BeanFactory beanFactory;
|
||||
|
||||
|
||||
/**
|
||||
* Set the actual bean instance to invoke this endpoint method on.
|
||||
|
@ -122,11 +120,10 @@ public class MethodJmsListenerEndpoint extends AbstractJmsListenerEndpoint imple
|
|||
}
|
||||
|
||||
/**
|
||||
* Set the {@link BeanFactory} to use to resolve expressions (can be {@code null}).
|
||||
* Set the {@link BeanFactory} to use to resolve expressions (may be {@code null}).
|
||||
*/
|
||||
@Override
|
||||
public void setBeanFactory(BeanFactory beanFactory) {
|
||||
this.beanFactory = beanFactory;
|
||||
if (this.embeddedValueResolver == null && beanFactory instanceof ConfigurableBeanFactory) {
|
||||
this.embeddedValueResolver = new EmbeddedValueResolver((ConfigurableBeanFactory) beanFactory);
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
* Copyright 2002-2017 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.
|
||||
|
@ -23,8 +23,9 @@ import javax.jms.Session;
|
|||
/**
|
||||
* Callback for browsing the messages in a JMS queue.
|
||||
*
|
||||
* <p>To be used with JmsTemplate's callback methods that take a BrowserCallback
|
||||
* argument, often implemented as an anonymous inner class.
|
||||
* <p>To be used with {@link JmsTemplate}'s callback methods that take a
|
||||
* {@link BrowserCallback} argument, often implemented as an anonymous
|
||||
* inner class or as a lambda expression.
|
||||
*
|
||||
* @author Juergen Hoeller
|
||||
* @since 2.5.1
|
||||
|
@ -35,11 +36,12 @@ import javax.jms.Session;
|
|||
public interface BrowserCallback<T> {
|
||||
|
||||
/**
|
||||
* Perform operations on the given {@link javax.jms.Session} and {@link javax.jms.QueueBrowser}.
|
||||
* <p>The message producer is not associated with any destination.
|
||||
* Perform operations on the given {@link javax.jms.Session} and
|
||||
* {@link javax.jms.QueueBrowser}.
|
||||
* @param session the JMS {@code Session} object to use
|
||||
* @param browser the JMS {@code QueueBrowser} object to use
|
||||
* @return a result object from working with the {@code Session}, if any (can be {@code null})
|
||||
* @return a result object from working with the {@code Session}, if any
|
||||
* (or {@code null} if none)
|
||||
* @throws javax.jms.JMSException if thrown by JMS API methods
|
||||
*/
|
||||
T doInJms(Session session, QueueBrowser browser) throws JMSException;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
* Copyright 2002-2017 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.
|
||||
|
@ -23,8 +23,9 @@ import javax.jms.Session;
|
|||
/**
|
||||
* Callback for sending a message to a JMS destination.
|
||||
*
|
||||
* <p>To be used with JmsTemplate's callback methods that take a ProducerCallback
|
||||
* argument, often implemented as an anonymous inner class.
|
||||
* <p>To be used with {@link JmsTemplate}'s callback methods that take a
|
||||
* {@link ProducerCallback} argument, often implemented as an anonymous
|
||||
* inner class or as a lambda expression.
|
||||
*
|
||||
* <p>The typical implementation will perform multiple operations on the
|
||||
* supplied JMS {@link Session} and {@link MessageProducer}.
|
||||
|
@ -44,7 +45,8 @@ public interface ProducerCallback<T> {
|
|||
* when specified in the JmsTemplate call.
|
||||
* @param session the JMS {@code Session} object to use
|
||||
* @param producer the JMS {@code MessageProducer} object to use
|
||||
* @return a result object from working with the {@code Session}, if any (can be {@code null})
|
||||
* @return a result object from working with the {@code Session}, if any
|
||||
* (or {@code null} if none)
|
||||
* @throws javax.jms.JMSException if thrown by JMS API methods
|
||||
*/
|
||||
T doInJms(Session session, MessageProducer producer) throws JMSException;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
* Copyright 2002-2017 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.
|
||||
|
@ -20,11 +20,10 @@ import javax.jms.JMSException;
|
|||
import javax.jms.Session;
|
||||
|
||||
/**
|
||||
* Callback for executing any number of operations on a provided
|
||||
* {@link Session}.
|
||||
* Callback for executing any number of operations on a provided {@link Session}.
|
||||
*
|
||||
* <p>To be used with the {@link JmsTemplate#execute(SessionCallback)}
|
||||
* method, often implemented as an anonymous inner class.
|
||||
* <p>To be used with the {@link JmsTemplate#execute(SessionCallback)} method,
|
||||
* often implemented as an anonymous inner class or as a lambda expression.
|
||||
*
|
||||
* @author Mark Pollack
|
||||
* @since 1.1
|
||||
|
@ -34,10 +33,11 @@ import javax.jms.Session;
|
|||
public interface SessionCallback<T> {
|
||||
|
||||
/**
|
||||
* Execute any number of operations against the supplied JMS
|
||||
* {@link Session}, possibly returning a result.
|
||||
* Execute any number of operations against the supplied JMS {@link Session},
|
||||
* possibly returning a result.
|
||||
* @param session the JMS {@code Session}
|
||||
* @return a result object from working with the {@code Session}, if any (so can be {@code null})
|
||||
* @return a result object from working with the {@code Session}, if any
|
||||
* (or {@code null} if none)
|
||||
* @throws javax.jms.JMSException if thrown by JMS API methods
|
||||
*/
|
||||
T doInJms(Session session) throws JMSException;
|
||||
|
|
Loading…
Reference in New Issue