Add @Override to remaining source files

Issue: SPR-10130
This commit is contained in:
Rob Winch
2013-05-13 16:47:34 -05:00
parent 30db112d37
commit 9468548116
1279 changed files with 5825 additions and 2 deletions

View File

@@ -80,6 +80,7 @@ public abstract class JmsException extends NestedRuntimeException {
* if there is one.
* @see javax.jms.JMSException#getLinkedException()
*/
@Override
public String getMessage() {
String message = super.getMessage();
Throwable cause = getCause();

View File

@@ -89,6 +89,7 @@ abstract class AbstractListenerContainerParser implements BeanDefinitionParser {
protected static final String PREFETCH_ATTRIBUTE = "prefetch";
@Override
public BeanDefinition parse(Element element, ParserContext parserContext) {
CompositeComponentDefinition compositeDef =
new CompositeComponentDefinition(element.getTagName(), parserContext.extractSource(element));

View File

@@ -37,6 +37,7 @@ class JcaListenerContainerParser extends AbstractListenerContainerParser {
private static final String ACTIVATION_SPEC_FACTORY_ATTRIBUTE = "activation-spec-factory";
@Override
protected BeanDefinition parseContainer(Element listenerEle, Element containerEle, ParserContext parserContext) {
RootBeanDefinition containerDef = new RootBeanDefinition();
containerDef.setSource(parserContext.extractSource(containerEle));

View File

@@ -50,6 +50,7 @@ class JmsListenerContainerParser extends AbstractListenerContainerParser {
private static final String RECEIVE_TIMEOUT_ATTRIBUTE = "receive-timeout";
@Override
protected BeanDefinition parseContainer(Element listenerEle, Element containerEle, ParserContext parserContext) {
RootBeanDefinition containerDef = new RootBeanDefinition();
containerDef.setSource(parserContext.extractSource(containerEle));

View File

@@ -28,6 +28,7 @@ import org.springframework.beans.factory.xml.NamespaceHandlerSupport;
*/
public class JmsNamespaceHandler extends NamespaceHandlerSupport {
@Override
public void init() {
registerBeanDefinitionParser("listener-container", new JmsListenerContainerParser());
registerBeanDefinitionParser("jca-listener-container", new JcaListenerContainerParser());

View File

@@ -42,47 +42,58 @@ class CachedMessageConsumer implements MessageConsumer, QueueReceiver, TopicSubs
}
@Override
public String getMessageSelector() throws JMSException {
return this.target.getMessageSelector();
}
@Override
public Queue getQueue() throws JMSException {
return (this.target instanceof QueueReceiver ? ((QueueReceiver) this.target).getQueue() : null);
}
@Override
public Topic getTopic() throws JMSException {
return (this.target instanceof TopicSubscriber ? ((TopicSubscriber) this.target).getTopic() : null);
}
@Override
public boolean getNoLocal() throws JMSException {
return (this.target instanceof TopicSubscriber && ((TopicSubscriber) this.target).getNoLocal());
}
@Override
public MessageListener getMessageListener() throws JMSException {
return this.target.getMessageListener();
}
@Override
public void setMessageListener(MessageListener messageListener) throws JMSException {
this.target.setMessageListener(messageListener);
}
@Override
public Message receive() throws JMSException {
return this.target.receive();
}
@Override
public Message receive(long timeout) throws JMSException {
return this.target.receive(timeout);
}
@Override
public Message receiveNoWait() throws JMSException {
return this.target.receiveNoWait();
}
@Override
public void close() throws JMSException {
// It's a cached MessageConsumer...
}
@Override
public String toString() {
return "Cached JMS MessageConsumer: " + this.target;
}

View File

@@ -92,6 +92,7 @@ class CachedMessageProducer implements MessageProducer, QueueSender, TopicPublis
}
@Override
public void setDisableMessageID(boolean disableMessageID) throws JMSException {
if (this.originalDisableMessageID == null) {
this.originalDisableMessageID = this.target.getDisableMessageID();
@@ -99,10 +100,12 @@ class CachedMessageProducer implements MessageProducer, QueueSender, TopicPublis
this.target.setDisableMessageID(disableMessageID);
}
@Override
public boolean getDisableMessageID() throws JMSException {
return this.target.getDisableMessageID();
}
@Override
public void setDisableMessageTimestamp(boolean disableMessageTimestamp) throws JMSException {
if (this.originalDisableMessageTimestamp == null) {
this.originalDisableMessageTimestamp = this.target.getDisableMessageTimestamp();
@@ -110,6 +113,7 @@ class CachedMessageProducer implements MessageProducer, QueueSender, TopicPublis
this.target.setDisableMessageTimestamp(disableMessageTimestamp);
}
@Override
public boolean getDisableMessageTimestamp() throws JMSException {
return this.target.getDisableMessageTimestamp();
}
@@ -125,82 +129,102 @@ class CachedMessageProducer implements MessageProducer, QueueSender, TopicPublis
return (Long) ReflectionUtils.invokeMethod(getDeliveryDelayMethod, this.target);
}
@Override
public void setDeliveryMode(int deliveryMode) {
this.deliveryMode = deliveryMode;
}
@Override
public int getDeliveryMode() {
return this.deliveryMode;
}
@Override
public void setPriority(int priority) {
this.priority = priority;
}
@Override
public int getPriority() {
return this.priority;
}
@Override
public void setTimeToLive(long timeToLive) {
this.timeToLive = timeToLive;
}
@Override
public long getTimeToLive() {
return this.timeToLive;
}
@Override
public Destination getDestination() throws JMSException {
return this.target.getDestination();
}
@Override
public Queue getQueue() throws JMSException {
return (Queue) this.target.getDestination();
}
@Override
public Topic getTopic() throws JMSException {
return (Topic) this.target.getDestination();
}
@Override
public void send(Message message) throws JMSException {
this.target.send(message, this.deliveryMode, this.priority, this.timeToLive);
}
@Override
public void send(Message message, int deliveryMode, int priority, long timeToLive) throws JMSException {
this.target.send(message, deliveryMode, priority, timeToLive);
}
@Override
public void send(Destination destination, Message message) throws JMSException {
this.target.send(destination, message, this.deliveryMode, this.priority, this.timeToLive);
}
@Override
public void send(Destination destination, Message message, int deliveryMode, int priority, long timeToLive) throws JMSException {
this.target.send(destination, message, deliveryMode, priority, timeToLive);
}
@Override
public void send(Queue queue, Message message) throws JMSException {
this.target.send(queue, message, this.deliveryMode, this.priority, this.timeToLive);
}
@Override
public void send(Queue queue, Message message, int deliveryMode, int priority, long timeToLive) throws JMSException {
this.target.send(queue, message, deliveryMode, priority, timeToLive);
}
@Override
public void publish(Message message) throws JMSException {
this.target.send(message, this.deliveryMode, this.priority, this.timeToLive);
}
@Override
public void publish(Message message, int deliveryMode, int priority, long timeToLive) throws JMSException {
this.target.send(message, deliveryMode, priority, timeToLive);
}
@Override
public void publish(Topic topic, Message message) throws JMSException {
this.target.send(topic, message, this.deliveryMode, this.priority, this.timeToLive);
}
@Override
public void publish(Topic topic, Message message, int deliveryMode, int priority, long timeToLive) throws JMSException {
this.target.send(topic, message, deliveryMode, priority, timeToLive);
}
@Override
public void close() throws JMSException {
// It's a cached MessageProducer... reset properties only.
if (this.originalDisableMessageID != null) {
@@ -217,6 +241,7 @@ class CachedMessageProducer implements MessageProducer, QueueSender, TopicPublis
}
}
@Override
public String toString() {
return "Cached JMS MessageProducer: " + this.target;
}
@@ -245,6 +270,7 @@ class CachedMessageProducer implements MessageProducer, QueueSender, TopicPublis
*/
private class Jms2MessageProducerInvocationHandler implements InvocationHandler {
@Override
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
try {
if (method.getName().equals("send") && args != null &&

View File

@@ -182,6 +182,7 @@ public class CachingConnectionFactory extends SingleConnectionFactory {
/**
* Resets the Session cache as well.
*/
@Override
public void resetConnection() {
this.active = false;
synchronized (this.cachedSessions) {
@@ -208,6 +209,7 @@ public class CachingConnectionFactory extends SingleConnectionFactory {
/**
* Checks for a cached Session for the given mode.
*/
@Override
protected Session getSession(Connection con, Integer mode) throws JMSException {
LinkedList<Session> sessionList;
synchronized (this.cachedSessions) {
@@ -285,6 +287,7 @@ public class CachingConnectionFactory extends SingleConnectionFactory {
this.sessionList = sessionList;
}
@Override
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
String methodName = method.getName();
if (methodName.equals("equals")) {
@@ -509,12 +512,14 @@ public class CachingConnectionFactory extends SingleConnectionFactory {
getDestinationString().equals(otherKey.getDestinationString())));
}
@Override
public boolean equals(Object other) {
// Effectively checking object equality as well as toString equality.
// On WebSphere MQ, Destination objects do not implement equals...
return (other == this || destinationEquals((DestinationCacheKey) other));
}
@Override
public int hashCode() {
// Can't use a more specific hashCode since we can't rely on
// this.destination.hashCode() actually being the same value
@@ -543,6 +548,7 @@ public class CachingConnectionFactory extends SingleConnectionFactory {
this.subscription = subscription;
}
@Override
public boolean equals(Object other) {
if (other == this) {
return true;

View File

@@ -52,6 +52,7 @@ public class ChainedExceptionListener implements ExceptionListener {
}
@Override
public void onException(JMSException ex) {
for (ExceptionListener listener : this.delegates) {
listener.onException(ex);

View File

@@ -136,18 +136,23 @@ public abstract class ConnectionFactoryUtils {
throws JMSException {
return doGetTransactionalSession(cf, new ResourceFactory() {
@Override
public Session getSession(JmsResourceHolder holder) {
return holder.getSession(Session.class, existingCon);
}
@Override
public Connection getConnection(JmsResourceHolder holder) {
return (existingCon != null ? existingCon : holder.getConnection());
}
@Override
public Connection createConnection() throws JMSException {
return cf.createConnection();
}
@Override
public Session createSession(Connection con) throws JMSException {
return con.createSession(synchedLocalTransactionAllowed, Session.AUTO_ACKNOWLEDGE);
}
@Override
public boolean isSynchedLocalTransactionAllowed() {
return synchedLocalTransactionAllowed;
}
@@ -173,18 +178,23 @@ public abstract class ConnectionFactoryUtils {
throws JMSException {
return (QueueSession) doGetTransactionalSession(cf, new ResourceFactory() {
@Override
public Session getSession(JmsResourceHolder holder) {
return holder.getSession(QueueSession.class, existingCon);
}
@Override
public Connection getConnection(JmsResourceHolder holder) {
return (existingCon != null ? existingCon : holder.getConnection(QueueConnection.class));
}
@Override
public Connection createConnection() throws JMSException {
return cf.createQueueConnection();
}
@Override
public Session createSession(Connection con) throws JMSException {
return ((QueueConnection) con).createQueueSession(synchedLocalTransactionAllowed, Session.AUTO_ACKNOWLEDGE);
}
@Override
public boolean isSynchedLocalTransactionAllowed() {
return synchedLocalTransactionAllowed;
}
@@ -210,18 +220,23 @@ public abstract class ConnectionFactoryUtils {
throws JMSException {
return (TopicSession) doGetTransactionalSession(cf, new ResourceFactory() {
@Override
public Session getSession(JmsResourceHolder holder) {
return holder.getSession(TopicSession.class, existingCon);
}
@Override
public Connection getConnection(JmsResourceHolder holder) {
return (existingCon != null ? existingCon : holder.getConnection(TopicConnection.class));
}
@Override
public Connection createConnection() throws JMSException {
return cf.createTopicConnection();
}
@Override
public Session createSession(Connection con) throws JMSException {
return ((TopicConnection) con).createTopicSession(synchedLocalTransactionAllowed, Session.AUTO_ACKNOWLEDGE);
}
@Override
public boolean isSynchedLocalTransactionAllowed() {
return synchedLocalTransactionAllowed;
}
@@ -395,10 +410,12 @@ public abstract class ConnectionFactoryUtils {
this.transacted = transacted;
}
@Override
protected boolean shouldReleaseBeforeCompletion() {
return !this.transacted;
}
@Override
protected void processResourceAfterCommit(JmsResourceHolder resourceHolder) {
try {
resourceHolder.commitAll();
@@ -408,6 +425,7 @@ public abstract class ConnectionFactoryUtils {
}
}
@Override
protected void releaseResource(JmsResourceHolder resourceHolder, Object resourceKey) {
resourceHolder.closeAll();
}

View File

@@ -85,6 +85,7 @@ public class DelegatingConnectionFactory
this.shouldStopConnections = shouldStopConnections;
}
@Override
public void afterPropertiesSet() {
if (getTargetConnectionFactory() == null) {
throw new IllegalArgumentException("'targetConnectionFactory' is required");
@@ -92,14 +93,17 @@ public class DelegatingConnectionFactory
}
@Override
public Connection createConnection() throws JMSException {
return getTargetConnectionFactory().createConnection();
}
@Override
public Connection createConnection(String username, String password) throws JMSException {
return getTargetConnectionFactory().createConnection(username, password);
}
@Override
public QueueConnection createQueueConnection() throws JMSException {
ConnectionFactory cf = getTargetConnectionFactory();
if (cf instanceof QueueConnectionFactory) {
@@ -114,6 +118,7 @@ public class DelegatingConnectionFactory
}
}
@Override
public QueueConnection createQueueConnection(String username, String password) throws JMSException {
ConnectionFactory cf = getTargetConnectionFactory();
if (cf instanceof QueueConnectionFactory) {
@@ -128,6 +133,7 @@ public class DelegatingConnectionFactory
}
}
@Override
public TopicConnection createTopicConnection() throws JMSException {
ConnectionFactory cf = getTargetConnectionFactory();
if (cf instanceof TopicConnectionFactory) {
@@ -142,6 +148,7 @@ public class DelegatingConnectionFactory
}
}
@Override
public TopicConnection createTopicConnection(String username, String password) throws JMSException {
ConnectionFactory cf = getTargetConnectionFactory();
if (cf instanceof TopicConnectionFactory) {
@@ -156,6 +163,7 @@ public class DelegatingConnectionFactory
}
}
@Override
public boolean shouldStop(Connection con) {
return this.shouldStopConnections;
}

View File

@@ -146,6 +146,7 @@ public class JmsTransactionManager extends AbstractPlatformTransactionManager
/**
* Make sure the ConnectionFactory has been set.
*/
@Override
public void afterPropertiesSet() {
if (getConnectionFactory() == null) {
throw new IllegalArgumentException("Property 'connectionFactory' is required");
@@ -153,10 +154,12 @@ public class JmsTransactionManager extends AbstractPlatformTransactionManager
}
@Override
public Object getResourceFactory() {
return getConnectionFactory();
}
@Override
protected Object doGetTransaction() {
JmsTransactionObject txObject = new JmsTransactionObject();
txObject.setResourceHolder(
@@ -164,11 +167,13 @@ public class JmsTransactionManager extends AbstractPlatformTransactionManager
return txObject;
}
@Override
protected boolean isExistingTransaction(Object transaction) {
JmsTransactionObject txObject = (JmsTransactionObject) transaction;
return (txObject.getResourceHolder() != null);
}
@Override
protected void doBegin(Object transaction, TransactionDefinition definition) {
if (definition.getIsolationLevel() != TransactionDefinition.ISOLATION_DEFAULT) {
throw new InvalidIsolationLevelException("JMS does not support an isolation level concept");
@@ -204,17 +209,20 @@ public class JmsTransactionManager extends AbstractPlatformTransactionManager
}
}
@Override
protected Object doSuspend(Object transaction) {
JmsTransactionObject txObject = (JmsTransactionObject) transaction;
txObject.setResourceHolder(null);
return TransactionSynchronizationManager.unbindResource(getConnectionFactory());
}
@Override
protected void doResume(Object transaction, Object suspendedResources) {
JmsResourceHolder conHolder = (JmsResourceHolder) suspendedResources;
TransactionSynchronizationManager.bindResource(getConnectionFactory(), conHolder);
}
@Override
protected void doCommit(DefaultTransactionStatus status) {
JmsTransactionObject txObject = (JmsTransactionObject) status.getTransaction();
Session session = txObject.getResourceHolder().getSession();
@@ -232,6 +240,7 @@ public class JmsTransactionManager extends AbstractPlatformTransactionManager
}
}
@Override
protected void doRollback(DefaultTransactionStatus status) {
JmsTransactionObject txObject = (JmsTransactionObject) status.getTransaction();
Session session = txObject.getResourceHolder().getSession();
@@ -246,11 +255,13 @@ public class JmsTransactionManager extends AbstractPlatformTransactionManager
}
}
@Override
protected void doSetRollbackOnly(DefaultTransactionStatus status) {
JmsTransactionObject txObject = (JmsTransactionObject) status.getTransaction();
txObject.getResourceHolder().setRollbackOnly();
}
@Override
protected void doCleanupAfterCompletion(Object transaction) {
JmsTransactionObject txObject = (JmsTransactionObject) transaction;
TransactionSynchronizationManager.unbindResource(getConnectionFactory());
@@ -302,10 +313,12 @@ public class JmsTransactionManager extends AbstractPlatformTransactionManager
return this.resourceHolder;
}
@Override
public boolean isRollbackOnly() {
return this.resourceHolder.isRollbackOnly();
}
@Override
public void flush() {
// no-op
}

View File

@@ -212,6 +212,7 @@ public class SingleConnectionFactory
/**
* Make sure a Connection or ConnectionFactory has been set.
*/
@Override
public void afterPropertiesSet() {
if (this.connection == null && getTargetConnectionFactory() == null) {
throw new IllegalArgumentException("Connection or 'targetConnectionFactory' is required");
@@ -219,6 +220,7 @@ public class SingleConnectionFactory
}
@Override
public Connection createConnection() throws JMSException {
synchronized (this.connectionMonitor) {
if (this.connection == null) {
@@ -228,11 +230,13 @@ public class SingleConnectionFactory
}
}
@Override
public Connection createConnection(String username, String password) throws JMSException {
throw new javax.jms.IllegalStateException(
"SingleConnectionFactory does not support custom username and password");
}
@Override
public QueueConnection createQueueConnection() throws JMSException {
Connection con;
synchronized (this.connectionMonitor) {
@@ -246,11 +250,13 @@ public class SingleConnectionFactory
return ((QueueConnection) con);
}
@Override
public QueueConnection createQueueConnection(String username, String password) throws JMSException {
throw new javax.jms.IllegalStateException(
"SingleConnectionFactory does not support custom username and password");
}
@Override
public TopicConnection createTopicConnection() throws JMSException {
Connection con;
synchronized (this.connectionMonitor) {
@@ -264,6 +270,7 @@ public class SingleConnectionFactory
return ((TopicConnection) con);
}
@Override
public TopicConnection createTopicConnection(String username, String password) throws JMSException {
throw new javax.jms.IllegalStateException(
"SingleConnectionFactory does not support custom username and password");
@@ -297,6 +304,7 @@ public class SingleConnectionFactory
/**
* Exception listener callback that renews the underlying single Connection.
*/
@Override
public void onException(JMSException ex) {
logger.warn("Encountered a JMSException - resetting the underlying JMS Connection", ex);
resetConnection();
@@ -308,6 +316,7 @@ public class SingleConnectionFactory
* <p>As this bean implements DisposableBean, a bean factory will
* automatically invoke this on destruction of its cached singletons.
*/
@Override
public void destroy() {
resetConnection();
}
@@ -469,6 +478,7 @@ public class SingleConnectionFactory
this.target = target;
}
@Override
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
if (method.getName().equals("equals")) {
// Only consider equal when proxies are identical.

View File

@@ -136,16 +136,19 @@ public class TransactionAwareConnectionFactoryProxy
}
@Override
public Connection createConnection() throws JMSException {
Connection targetConnection = this.targetConnectionFactory.createConnection();
return getTransactionAwareConnectionProxy(targetConnection);
}
@Override
public Connection createConnection(String username, String password) throws JMSException {
Connection targetConnection = this.targetConnectionFactory.createConnection(username, password);
return getTransactionAwareConnectionProxy(targetConnection);
}
@Override
public QueueConnection createQueueConnection() throws JMSException {
if (!(this.targetConnectionFactory instanceof QueueConnectionFactory)) {
throw new javax.jms.IllegalStateException("'targetConnectionFactory' is no QueueConnectionFactory");
@@ -155,6 +158,7 @@ public class TransactionAwareConnectionFactoryProxy
return (QueueConnection) getTransactionAwareConnectionProxy(targetConnection);
}
@Override
public QueueConnection createQueueConnection(String username, String password) throws JMSException {
if (!(this.targetConnectionFactory instanceof QueueConnectionFactory)) {
throw new javax.jms.IllegalStateException("'targetConnectionFactory' is no QueueConnectionFactory");
@@ -164,6 +168,7 @@ public class TransactionAwareConnectionFactoryProxy
return (QueueConnection) getTransactionAwareConnectionProxy(targetConnection);
}
@Override
public TopicConnection createTopicConnection() throws JMSException {
if (!(this.targetConnectionFactory instanceof TopicConnectionFactory)) {
throw new javax.jms.IllegalStateException("'targetConnectionFactory' is no TopicConnectionFactory");
@@ -173,6 +178,7 @@ public class TransactionAwareConnectionFactoryProxy
return (TopicConnection) getTransactionAwareConnectionProxy(targetConnection);
}
@Override
public TopicConnection createTopicConnection(String username, String password) throws JMSException {
if (!(this.targetConnectionFactory instanceof TopicConnectionFactory)) {
throw new javax.jms.IllegalStateException("'targetConnectionFactory' is no TopicConnectionFactory");
@@ -216,6 +222,7 @@ public class TransactionAwareConnectionFactoryProxy
this.target = target;
}
@Override
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
// Invocation on ConnectionProxy interface coming in...
@@ -288,6 +295,7 @@ public class TransactionAwareConnectionFactoryProxy
this.target = target;
}
@Override
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
// Invocation on SessionProxy interface coming in...

View File

@@ -104,6 +104,7 @@ public class UserCredentialsConnectionFactoryAdapter
this.password = password;
}
@Override
public void afterPropertiesSet() {
if (this.targetConnectionFactory == null) {
throw new IllegalArgumentException("Property 'targetConnectionFactory' is required");
@@ -141,6 +142,7 @@ public class UserCredentialsConnectionFactoryAdapter
* username and password (i.e. values of the bean properties) else.
* @see #doCreateConnection
*/
@Override
public final Connection createConnection() throws JMSException {
JmsUserCredentials threadCredentials = this.threadBoundCredentials.get();
if (threadCredentials != null) {
@@ -154,6 +156,7 @@ public class UserCredentialsConnectionFactoryAdapter
/**
* Delegate the call straight to the target ConnectionFactory.
*/
@Override
public Connection createConnection(String username, String password) throws JMSException {
return doCreateConnection(username, password);
}
@@ -186,6 +189,7 @@ public class UserCredentialsConnectionFactoryAdapter
* username and password (i.e. values of the bean properties) else.
* @see #doCreateQueueConnection
*/
@Override
public final QueueConnection createQueueConnection() throws JMSException {
JmsUserCredentials threadCredentials = this.threadBoundCredentials.get();
if (threadCredentials != null) {
@@ -199,6 +203,7 @@ public class UserCredentialsConnectionFactoryAdapter
/**
* Delegate the call straight to the target QueueConnectionFactory.
*/
@Override
public QueueConnection createQueueConnection(String username, String password) throws JMSException {
return doCreateQueueConnection(username, password);
}
@@ -235,6 +240,7 @@ public class UserCredentialsConnectionFactoryAdapter
* username and password (i.e. values of the bean properties) else.
* @see #doCreateTopicConnection
*/
@Override
public final TopicConnection createTopicConnection() throws JMSException {
JmsUserCredentials threadCredentials = this.threadBoundCredentials.get();
if (threadCredentials != null) {
@@ -248,6 +254,7 @@ public class UserCredentialsConnectionFactoryAdapter
/**
* Delegate the call straight to the target TopicConnectionFactory.
*/
@Override
public TopicConnection createTopicConnection(String username, String password) throws JMSException {
return doCreateTopicConnection(username, password);
}
@@ -292,6 +299,7 @@ public class UserCredentialsConnectionFactoryAdapter
this.password = password;
}
@Override
public String toString() {
return "JmsUserCredentials[username='" + this.username + "',password='" + this.password + "']";
}

View File

@@ -451,6 +451,7 @@ public class JmsTemplate extends JmsDestinationAccessor implements JmsOperations
// JmsOperations execute methods
//-------------------------------------------------------------------------
@Override
public <T> T execute(SessionCallback<T> action) throws JmsException {
return execute(action, false);
}
@@ -498,6 +499,7 @@ public class JmsTemplate extends JmsDestinationAccessor implements JmsOperations
}
}
@Override
public <T> T execute(ProducerCallback<T> action) throws JmsException {
String defaultDestinationName = getDefaultDestinationName();
if (defaultDestinationName != null) {
@@ -508,9 +510,11 @@ public class JmsTemplate extends JmsDestinationAccessor implements JmsOperations
}
}
@Override
public <T> T execute(final Destination destination, final ProducerCallback<T> action) throws JmsException {
Assert.notNull(action, "Callback object must not be null");
return execute(new SessionCallback<T>() {
@Override
public T doInJms(Session session) throws JMSException {
MessageProducer producer = createProducer(session, destination);
try {
@@ -523,9 +527,11 @@ public class JmsTemplate extends JmsDestinationAccessor implements JmsOperations
}, false);
}
@Override
public <T> T execute(final String destinationName, final ProducerCallback<T> action) throws JmsException {
Assert.notNull(action, "Callback object must not be null");
return execute(new SessionCallback<T>() {
@Override
public T doInJms(Session session) throws JMSException {
Destination destination = resolveDestinationName(session, destinationName);
MessageProducer producer = createProducer(session, destination);
@@ -544,6 +550,7 @@ public class JmsTemplate extends JmsDestinationAccessor implements JmsOperations
// Convenience methods for sending messages
//-------------------------------------------------------------------------
@Override
public void send(MessageCreator messageCreator) throws JmsException {
Destination defaultDestination = getDefaultDestination();
if (defaultDestination != null) {
@@ -554,8 +561,10 @@ public class JmsTemplate extends JmsDestinationAccessor implements JmsOperations
}
}
@Override
public void send(final Destination destination, final MessageCreator messageCreator) throws JmsException {
execute(new SessionCallback<Object>() {
@Override
public Object doInJms(Session session) throws JMSException {
doSend(session, destination, messageCreator);
return null;
@@ -563,8 +572,10 @@ public class JmsTemplate extends JmsDestinationAccessor implements JmsOperations
}, false);
}
@Override
public void send(final String destinationName, final MessageCreator messageCreator) throws JmsException {
execute(new SessionCallback<Object>() {
@Override
public Object doInJms(Session session) throws JMSException {
Destination destination = resolveDestinationName(session, destinationName);
doSend(session, destination, messageCreator);
@@ -628,6 +639,7 @@ public class JmsTemplate extends JmsDestinationAccessor implements JmsOperations
// Convenience methods for sending auto-converted messages
//-------------------------------------------------------------------------
@Override
public void convertAndSend(Object message) throws JmsException {
Destination defaultDestination = getDefaultDestination();
if (defaultDestination != null) {
@@ -638,22 +650,27 @@ public class JmsTemplate extends JmsDestinationAccessor implements JmsOperations
}
}
@Override
public void convertAndSend(Destination destination, final Object message) throws JmsException {
send(destination, new MessageCreator() {
@Override
public Message createMessage(Session session) throws JMSException {
return getRequiredMessageConverter().toMessage(message, session);
}
});
}
@Override
public void convertAndSend(String destinationName, final Object message) throws JmsException {
send(destinationName, new MessageCreator() {
@Override
public Message createMessage(Session session) throws JMSException {
return getRequiredMessageConverter().toMessage(message, session);
}
});
}
@Override
public void convertAndSend(Object message, MessagePostProcessor postProcessor) throws JmsException {
Destination defaultDestination = getDefaultDestination();
if (defaultDestination != null) {
@@ -664,11 +681,13 @@ public class JmsTemplate extends JmsDestinationAccessor implements JmsOperations
}
}
@Override
public void convertAndSend(
Destination destination, final Object message, final MessagePostProcessor postProcessor)
throws JmsException {
send(destination, new MessageCreator() {
@Override
public Message createMessage(Session session) throws JMSException {
Message msg = getRequiredMessageConverter().toMessage(message, session);
return postProcessor.postProcessMessage(msg);
@@ -676,11 +695,13 @@ public class JmsTemplate extends JmsDestinationAccessor implements JmsOperations
});
}
@Override
public void convertAndSend(
String destinationName, final Object message, final MessagePostProcessor postProcessor)
throws JmsException {
send(destinationName, new MessageCreator() {
@Override
public Message createMessage(Session session) throws JMSException {
Message msg = getRequiredMessageConverter().toMessage(message, session);
return postProcessor.postProcessMessage(msg);
@@ -693,6 +714,7 @@ public class JmsTemplate extends JmsDestinationAccessor implements JmsOperations
// Convenience methods for receiving messages
//-------------------------------------------------------------------------
@Override
public Message receive() throws JmsException {
Destination defaultDestination = getDefaultDestination();
if (defaultDestination != null) {
@@ -703,14 +725,17 @@ public class JmsTemplate extends JmsDestinationAccessor implements JmsOperations
}
}
@Override
public Message receive(Destination destination) throws JmsException {
return receiveSelected(destination, null);
}
@Override
public Message receive(String destinationName) throws JmsException {
return receiveSelected(destinationName, null);
}
@Override
public Message receiveSelected(String messageSelector) throws JmsException {
Destination defaultDestination = getDefaultDestination();
if (defaultDestination != null) {
@@ -721,16 +746,20 @@ public class JmsTemplate extends JmsDestinationAccessor implements JmsOperations
}
}
@Override
public Message receiveSelected(final Destination destination, final String messageSelector) throws JmsException {
return execute(new SessionCallback<Message>() {
@Override
public Message doInJms(Session session) throws JMSException {
return doReceive(session, destination, messageSelector);
}
}, true);
}
@Override
public Message receiveSelected(final String destinationName, final String messageSelector) throws JmsException {
return execute(new SessionCallback<Message>() {
@Override
public Message doInJms(Session session) throws JMSException {
Destination destination = resolveDestinationName(session, destinationName);
return doReceive(session, destination, messageSelector);
@@ -813,26 +842,32 @@ public class JmsTemplate extends JmsDestinationAccessor implements JmsOperations
// Convenience methods for receiving auto-converted messages
//-------------------------------------------------------------------------
@Override
public Object receiveAndConvert() throws JmsException {
return doConvertFromMessage(receive());
}
@Override
public Object receiveAndConvert(Destination destination) throws JmsException {
return doConvertFromMessage(receive(destination));
}
@Override
public Object receiveAndConvert(String destinationName) throws JmsException {
return doConvertFromMessage(receive(destinationName));
}
@Override
public Object receiveSelectedAndConvert(String messageSelector) throws JmsException {
return doConvertFromMessage(receiveSelected(messageSelector));
}
@Override
public Object receiveSelectedAndConvert(Destination destination, String messageSelector) throws JmsException {
return doConvertFromMessage(receiveSelected(destination, messageSelector));
}
@Override
public Object receiveSelectedAndConvert(String destinationName, String messageSelector) throws JmsException {
return doConvertFromMessage(receiveSelected(destinationName, messageSelector));
}
@@ -859,6 +894,7 @@ public class JmsTemplate extends JmsDestinationAccessor implements JmsOperations
// Convenience methods for browsing messages
//-------------------------------------------------------------------------
@Override
public <T> T browse(BrowserCallback<T> action) throws JmsException {
Queue defaultQueue = getDefaultQueue();
if (defaultQueue != null) {
@@ -869,14 +905,17 @@ public class JmsTemplate extends JmsDestinationAccessor implements JmsOperations
}
}
@Override
public <T> T browse(Queue queue, BrowserCallback<T> action) throws JmsException {
return browseSelected(queue, null, action);
}
@Override
public <T> T browse(String queueName, BrowserCallback<T> action) throws JmsException {
return browseSelected(queueName, null, action);
}
@Override
public <T> T browseSelected(String messageSelector, BrowserCallback<T> action) throws JmsException {
Queue defaultQueue = getDefaultQueue();
if (defaultQueue != null) {
@@ -887,11 +926,13 @@ public class JmsTemplate extends JmsDestinationAccessor implements JmsOperations
}
}
@Override
public <T> T browseSelected(final Queue queue, final String messageSelector, final BrowserCallback<T> action)
throws JmsException {
Assert.notNull(action, "Callback object must not be null");
return execute(new SessionCallback<T>() {
@Override
public T doInJms(Session session) throws JMSException {
QueueBrowser browser = createBrowser(session, queue, messageSelector);
try {
@@ -904,11 +945,13 @@ public class JmsTemplate extends JmsDestinationAccessor implements JmsOperations
}, true);
}
@Override
public <T> T browseSelected(final String queueName, final String messageSelector, final BrowserCallback<T> action)
throws JmsException {
Assert.notNull(action, "Callback object must not be null");
return execute(new SessionCallback<T>() {
@Override
public T doInJms(Session session) throws JMSException {
Queue queue = (Queue) getDestinationResolver().resolveDestinationName(session, queueName, false);
QueueBrowser browser = createBrowser(session, queue, messageSelector);
@@ -1049,22 +1092,27 @@ public class JmsTemplate extends JmsDestinationAccessor implements JmsOperations
*/
private class JmsTemplateResourceFactory implements ConnectionFactoryUtils.ResourceFactory {
@Override
public Connection getConnection(JmsResourceHolder holder) {
return JmsTemplate.this.getConnection(holder);
}
@Override
public Session getSession(JmsResourceHolder holder) {
return JmsTemplate.this.getSession(holder);
}
@Override
public Connection createConnection() throws JMSException {
return JmsTemplate.this.createConnection();
}
@Override
public Session createSession(Connection con) throws JMSException {
return JmsTemplate.this.createSession(con);
}
@Override
public boolean isSynchedLocalTransactionAllowed() {
return JmsTemplate.this.isSessionTransacted();
}

View File

@@ -96,6 +96,7 @@ public abstract class JmsGatewaySupport implements InitializingBean {
return this.jmsTemplate;
}
@Override
public final void afterPropertiesSet() throws IllegalArgumentException, BeanInitializationException {
if (this.jmsTemplate == null) {
throw new IllegalArgumentException("'connectionFactory' or 'jmsTemplate' is required");

View File

@@ -113,6 +113,7 @@ public abstract class AbstractJmsListeningContainer extends JmsDestinationAccess
this.autoStartup = autoStartup;
}
@Override
public boolean isAutoStartup() {
return this.autoStartup;
}
@@ -131,10 +132,12 @@ public abstract class AbstractJmsListeningContainer extends JmsDestinationAccess
/**
* Return the phase in which this container will be started and stopped.
*/
@Override
public int getPhase() {
return this.phase;
}
@Override
public void setBeanName(String beanName) {
this.beanName = beanName;
}
@@ -169,6 +172,7 @@ public abstract class AbstractJmsListeningContainer extends JmsDestinationAccess
* Calls {@link #shutdown()} when the BeanFactory destroys the container instance.
* @see #shutdown()
*/
@Override
public void destroy() {
shutdown();
}
@@ -260,6 +264,7 @@ public abstract class AbstractJmsListeningContainer extends JmsDestinationAccess
* @throws JmsException if starting failed
* @see #doStart
*/
@Override
public void start() throws JmsException {
try {
doStart();
@@ -298,6 +303,7 @@ public abstract class AbstractJmsListeningContainer extends JmsDestinationAccess
* @throws JmsException if stopping failed
* @see #doStop
*/
@Override
public void stop() throws JmsException {
try {
doStop();
@@ -307,6 +313,7 @@ public abstract class AbstractJmsListeningContainer extends JmsDestinationAccess
}
}
@Override
public void stop(Runnable callback) {
this.stop();
callback.run();
@@ -335,6 +342,7 @@ public abstract class AbstractJmsListeningContainer extends JmsDestinationAccess
* @see #stop()
* @see #runningAllowed()
*/
@Override
public final boolean isRunning() {
synchronized (this.lifecycleMonitor) {
return (this.running && runningAllowed());

View File

@@ -509,14 +509,17 @@ public abstract class AbstractPollingMessageListenerContainer extends AbstractMe
*/
private class MessageListenerContainerResourceFactory implements ConnectionFactoryUtils.ResourceFactory {
@Override
public Connection getConnection(JmsResourceHolder holder) {
return AbstractPollingMessageListenerContainer.this.getConnection(holder);
}
@Override
public Session getSession(JmsResourceHolder holder) {
return AbstractPollingMessageListenerContainer.this.getSession(holder);
}
@Override
public Connection createConnection() throws JMSException {
if (AbstractPollingMessageListenerContainer.this.sharedConnectionEnabled()) {
Connection sharedCon = AbstractPollingMessageListenerContainer.this.getSharedConnection();
@@ -527,10 +530,12 @@ public abstract class AbstractPollingMessageListenerContainer extends AbstractMe
}
}
@Override
public Session createSession(Connection con) throws JMSException {
return AbstractPollingMessageListenerContainer.this.createSession(con);
}
@Override
public boolean isSynchedLocalTransactionAllowed() {
return AbstractPollingMessageListenerContainer.this.isSessionTransacted();
}

View File

@@ -974,6 +974,7 @@ public class DefaultMessageListenerContainer extends AbstractPollingMessageListe
private volatile boolean idle = true;
@Override
public void run() {
synchronized (lifecycleMonitor) {
activeInvokerCount++;
@@ -1150,6 +1151,7 @@ public class DefaultMessageListenerContainer extends AbstractPollingMessageListe
this.session = null;
}
@Override
public boolean isLongLived() {
return (maxMessagesPerTask < 0);
}

View File

@@ -240,6 +240,7 @@ public class SimpleMessageListenerContainer extends AbstractMessageListenerConta
* shared connection and its sessions and consumers.
* @param ex the reported connection exception
*/
@Override
public void onException(JMSException ex) {
// First invoke the user-specific ExceptionListener, if any.
invokeExceptionListener(ex);
@@ -301,8 +302,10 @@ public class SimpleMessageListenerContainer extends AbstractMessageListenerConta
if (this.taskExecutor != null) {
consumer.setMessageListener(new MessageListener() {
@Override
public void onMessage(final Message message) {
taskExecutor.execute(new Runnable() {
@Override
public void run() {
processMessage(message, session);
}
@@ -312,6 +315,7 @@ public class SimpleMessageListenerContainer extends AbstractMessageListenerConta
}
else {
consumer.setMessageListener(new MessageListener() {
@Override
public void onMessage(Message message) {
processMessage(message, session);
}

View File

@@ -301,6 +301,7 @@ public class MessageListenerAdapter
* @see #handleListenerException
* @see #onMessage(javax.jms.Message, javax.jms.Session)
*/
@Override
public void onMessage(Message message) {
try {
onMessage(message, null);
@@ -319,6 +320,7 @@ public class MessageListenerAdapter
* @param session the JMS session to operate on
* @throws JMSException if thrown by JMS API methods
*/
@Override
@SuppressWarnings("unchecked")
public void onMessage(Message message, Session session) throws JMSException {
// Check whether the delegate is a MessageListener impl itself.
@@ -361,6 +363,7 @@ public class MessageListenerAdapter
}
}
@Override
public String getSubscriptionName() {
Object delegate = getDelegate();
if (delegate != this && delegate instanceof SubscriptionNameProvider) {

View File

@@ -72,6 +72,7 @@ public class DefaultJmsActivationSpecFactory extends StandardJmsActivationSpecFa
* "ActiveMQActivationSpec" in the same package, or a class named
* "ActivationSpecImpl" in the same package as the ResourceAdapter class.
*/
@Override
protected Class determineActivationSpecClass(ResourceAdapter adapter) {
String adapterClassName = adapter.getClass().getName();
@@ -131,6 +132,7 @@ public class DefaultJmsActivationSpecFactory extends StandardJmsActivationSpecFa
* "maxMessagesPerSessions"/"maxMessages", respectively
* (following ActiveMQ's and JORAM's naming conventions).
*/
@Override
protected void populateActivationSpecProperties(BeanWrapper bw, JmsActivationSpecConfig config) {
super.populateActivationSpecProperties(bw, config);
if (config.getMaxConcurrency() > 0) {
@@ -168,6 +170,7 @@ public class DefaultJmsActivationSpecFactory extends StandardJmsActivationSpecFa
* ActivationSpec property named "useRAManagedTransaction", if available
* (following ActiveMQ's naming conventions).
*/
@Override
protected void applyAcknowledgeMode(BeanWrapper bw, int ackMode) {
if (ackMode == Session.SESSION_TRANSACTED && bw.isWritableProperty("useRAManagedTransaction")) {
// ActiveMQ

View File

@@ -59,6 +59,7 @@ public class JmsMessageEndpointFactory extends AbstractMessageEndpointFactory {
/**
* Creates a concrete JMS message endpoint, internal to this factory.
*/
@Override
protected AbstractMessageEndpoint createEndpointInternal() throws UnavailableException {
return new JmsMessageEndpoint();
}
@@ -69,6 +70,7 @@ public class JmsMessageEndpointFactory extends AbstractMessageEndpointFactory {
*/
private class JmsMessageEndpoint extends AbstractMessageEndpoint implements MessageListener {
@Override
public void onMessage(Message message) {
boolean applyDeliveryCalls = !hasBeforeDeliveryBeenCalled();
if (applyDeliveryCalls) {
@@ -102,6 +104,7 @@ public class JmsMessageEndpointFactory extends AbstractMessageEndpointFactory {
}
}
@Override
protected ClassLoader getEndpointClassLoader() {
return messageListener.getClass().getClassLoader();
}

View File

@@ -128,6 +128,7 @@ public class JmsMessageEndpointManager extends GenericMessageEndpointManager {
}
@Override
public void afterPropertiesSet() throws ResourceException {
if (this.messageListenerSet) {
setMessageEndpointFactory(this.endpointFactory);

View File

@@ -91,6 +91,7 @@ public class StandardJmsActivationSpecFactory implements JmsActivationSpecFactor
}
@Override
public ActivationSpec createActivationSpec(ResourceAdapter adapter, JmsActivationSpecConfig config) {
Class activationSpecClassToUse = this.activationSpecClass;
if (activationSpecClassToUse == null) {

View File

@@ -180,6 +180,7 @@ public class JmsInvokerClientInterceptor implements MethodInterceptor, Initializ
}
@Override
public void afterPropertiesSet() {
if (getConnectionFactory() == null) {
throw new IllegalArgumentException("Property 'connectionFactory' is required");
@@ -190,6 +191,7 @@ public class JmsInvokerClientInterceptor implements MethodInterceptor, Initializ
}
@Override
public Object invoke(MethodInvocation methodInvocation) throws Throwable {
if (AopUtils.isToStringMethod(methodInvocation.getMethod())) {
return "JMS invoker proxy for queue [" + this.queue + "]";

View File

@@ -64,10 +64,12 @@ public class JmsInvokerProxyFactoryBean extends JmsInvokerClientInterceptor
this.serviceInterface = serviceInterface;
}
@Override
public void setBeanClassLoader(ClassLoader classLoader) {
this.beanClassLoader = classLoader;
}
@Override
public void afterPropertiesSet() {
super.afterPropertiesSet();
if (this.serviceInterface == null) {
@@ -77,14 +79,17 @@ public class JmsInvokerProxyFactoryBean extends JmsInvokerClientInterceptor
}
@Override
public Object getObject() {
return this.serviceProxy;
}
@Override
public Class<?> getObjectType() {
return this.serviceInterface;
}
@Override
public boolean isSingleton() {
return true;
}

View File

@@ -89,11 +89,13 @@ public class JmsInvokerServiceExporter extends RemoteInvocationBasedExporter
this.ignoreInvalidRequests = ignoreInvalidRequests;
}
@Override
public void afterPropertiesSet() {
this.proxy = getProxyForService();
}
@Override
public void onMessage(Message requestMessage, Session session) throws JMSException {
RemoteInvocation invocation = readRemoteInvocation(requestMessage);
if (invocation != null) {

View File

@@ -147,6 +147,7 @@ public abstract class JmsAccessor implements InitializingBean {
return this.sessionAcknowledgeMode;
}
@Override
public void afterPropertiesSet() {
if (getConnectionFactory() == null) {
throw new IllegalArgumentException("Property 'connectionFactory' is required");

View File

@@ -147,11 +147,13 @@ public class MappingJackson2MessageConverter implements MessageConverter, BeanCl
}
}
@Override
public void setBeanClassLoader(ClassLoader classLoader) {
this.beanClassLoader = classLoader;
}
@Override
public Message toMessage(Object object, Session session) throws JMSException, MessageConversionException {
Message message;
try {
@@ -173,6 +175,7 @@ public class MappingJackson2MessageConverter implements MessageConverter, BeanCl
return message;
}
@Override
public Object fromMessage(Message message) throws JMSException, MessageConversionException {
try {
JavaType targetJavaType = getJavaTypeForMessage(message);

View File

@@ -147,11 +147,13 @@ public class MappingJacksonMessageConverter implements MessageConverter, BeanCla
}
}
@Override
public void setBeanClassLoader(ClassLoader classLoader) {
this.beanClassLoader = classLoader;
}
@Override
public Message toMessage(Object object, Session session) throws JMSException, MessageConversionException {
Message message;
try {
@@ -173,6 +175,7 @@ public class MappingJacksonMessageConverter implements MessageConverter, BeanCla
return message;
}
@Override
public Object fromMessage(Message message) throws JMSException, MessageConversionException {
try {
JavaType targetJavaType = getJavaTypeForMessage(message);

View File

@@ -132,6 +132,7 @@ public class MarshallingMessageConverter implements MessageConverter, Initializi
this.targetType = targetType;
}
@Override
public void afterPropertiesSet() {
Assert.notNull(this.marshaller, "Property 'marshaller' is required");
Assert.notNull(this.unmarshaller, "Property 'unmarshaller' is required");
@@ -145,6 +146,7 @@ public class MarshallingMessageConverter implements MessageConverter, Initializi
* @see #marshalToTextMessage
* @see #marshalToBytesMessage
*/
@Override
public Message toMessage(Object object, Session session) throws JMSException, MessageConversionException {
try {
switch (this.targetType) {
@@ -169,6 +171,7 @@ public class MarshallingMessageConverter implements MessageConverter, Initializi
* @see #unmarshalFromTextMessage
* @see #unmarshalFromBytesMessage
*/
@Override
public Object fromMessage(Message message) throws JMSException, MessageConversionException {
try {
if (message instanceof TextMessage) {

View File

@@ -56,6 +56,7 @@ public class SimpleMessageConverter implements MessageConverter {
* @see #createMessageForMap
* @see #createMessageForSerializable
*/
@Override
public Message toMessage(Object object, Session session) throws JMSException, MessageConversionException {
if (object instanceof Message) {
return (Message) object;
@@ -89,6 +90,7 @@ public class SimpleMessageConverter implements MessageConverter {
* @see #extractMapFromMessage
* @see #extractSerializableFromMessage
*/
@Override
public Object fromMessage(Message message) throws JMSException, MessageConversionException {
if (message instanceof TextMessage) {
return extractStringFromMessage((TextMessage) message);

View File

@@ -63,11 +63,13 @@ public class BeanFactoryDestinationResolver implements DestinationResolver, Bean
}
@Override
public void setBeanFactory(BeanFactory beanFactory) {
this.beanFactory = beanFactory;
}
@Override
public Destination resolveDestinationName(Session session, String destinationName, boolean pubSubDomain)
throws JMSException {

View File

@@ -54,6 +54,7 @@ public class DynamicDestinationResolver implements DestinationResolver {
* @see #resolveTopic(javax.jms.Session, String)
* @see #resolveQueue(javax.jms.Session, String)
*/
@Override
public Destination resolveDestinationName(Session session, String destinationName, boolean pubSubDomain)
throws JMSException {

View File

@@ -98,6 +98,7 @@ public class JndiDestinationResolver extends JndiLocatorSupport implements Cachi
}
@Override
public Destination resolveDestinationName(Session session, String destinationName, boolean pubSubDomain)
throws JMSException {
@@ -150,10 +151,12 @@ public class JndiDestinationResolver extends JndiLocatorSupport implements Cachi
}
@Override
public void removeFromCache(String destinationName) {
this.destinationCache.remove(destinationName);
}
@Override
public void clearCache() {
this.destinationCache.clear();
}