Add @Override annotations to main sources

Issue: SPR-10130
This commit is contained in:
Chris Beams
2012-12-28 14:00:16 +01:00
parent 9c2046c3ee
commit 3b40ce76bf
1256 changed files with 5716 additions and 0 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

@@ -88,6 +88,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,42 +42,52 @@ 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...
}

View File

@@ -55,6 +55,7 @@ class CachedMessageProducer implements MessageProducer, QueueSender, TopicPublis
}
@Override
public void setDisableMessageID(boolean disableMessageID) throws JMSException {
if (this.originalDisableMessageID == null) {
this.originalDisableMessageID = Boolean.valueOf(this.target.getDisableMessageID());
@@ -62,10 +63,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 = Boolean.valueOf(this.target.getDisableMessageTimestamp());
@@ -73,86 +76,107 @@ class CachedMessageProducer implements MessageProducer, QueueSender, TopicPublis
this.target.setDisableMessageTimestamp(disableMessageTimestamp);
}
@Override
public boolean getDisableMessageTimestamp() throws JMSException {
return this.target.getDisableMessageTimestamp();
}
@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) {

View File

@@ -176,6 +176,7 @@ public class CachingConnectionFactory extends SingleConnectionFactory {
/**
* Resets the Session cache as well.
*/
@Override
public void resetConnection() {
this.active = false;
synchronized (this.cachedSessions) {
@@ -202,6 +203,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) {
@@ -279,6 +281,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")) {

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

@@ -100,6 +100,7 @@ public class JmsTransactionManager102 extends JmsTransactionManager {
* the specified destination type: QueueConnectionFactory for queues,
* and TopicConnectionFactory for topics.
*/
@Override
public void afterPropertiesSet() {
super.afterPropertiesSet();
@@ -127,6 +128,7 @@ public class JmsTransactionManager102 extends JmsTransactionManager {
/**
* This implementation overrides the superclass method to use JMS 1.0.2 API.
*/
@Override
protected Connection createConnection() throws JMSException {
if (isPubSubDomain()) {
return ((TopicConnectionFactory) getConnectionFactory()).createTopicConnection();
@@ -139,6 +141,7 @@ public class JmsTransactionManager102 extends JmsTransactionManager {
/**
* This implementation overrides the superclass method to use JMS 1.0.2 API.
*/
@Override
protected Session createSession(Connection con) throws JMSException {
if (isPubSubDomain()) {
return ((TopicConnection) con).createTopicSession(true, Session.AUTO_ACKNOWLEDGE);

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

@@ -93,6 +93,7 @@ public class SingleConnectionFactory102 extends SingleConnectionFactory {
* the specified destination type: QueueConnectionFactory for queues,
* TopicConnectionFactory for topics.
*/
@Override
public void afterPropertiesSet() {
super.afterPropertiesSet();
@@ -119,6 +120,7 @@ public class SingleConnectionFactory102 extends SingleConnectionFactory {
/**
* This implementation overrides the superclass method to use JMS 1.0.2 API.
*/
@Override
protected Connection doCreateConnection() throws JMSException {
if (isPubSubDomain()) {
return ((TopicConnectionFactory) getTargetConnectionFactory()).createTopicConnection();

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);
}

View File

@@ -427,6 +427,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);
}
@@ -474,6 +475,7 @@ public class JmsTemplate extends JmsDestinationAccessor implements JmsOperations
}
}
@Override
public <T> T execute(ProducerCallback<T> action) throws JmsException {
String defaultDestinationName = getDefaultDestinationName();
if (defaultDestinationName != null) {
@@ -484,9 +486,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 {
@@ -499,9 +503,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);
@@ -520,6 +526,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) {
@@ -530,8 +537,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;
@@ -539,8 +548,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);
@@ -598,6 +609,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) {
@@ -608,22 +620,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) {
@@ -634,11 +651,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);
@@ -646,11 +665,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);
@@ -663,6 +684,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) {
@@ -673,14 +695,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) {
@@ -691,16 +716,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);
@@ -783,26 +812,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));
}
@@ -829,6 +864,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) {
@@ -839,14 +875,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) {
@@ -857,11 +896,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 {
@@ -874,11 +915,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);
@@ -1019,22 +1062,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

@@ -111,6 +111,7 @@ public class JmsTemplate102 extends JmsTemplate {
* @see org.springframework.jms.support.destination.DynamicDestinationResolver
* @see org.springframework.jms.support.converter.SimpleMessageConverter102
*/
@Override
protected void initDefaultStrategies() {
setMessageConverter(new SimpleMessageConverter102());
}
@@ -121,6 +122,7 @@ public class JmsTemplate102 extends JmsTemplate {
* the specified destination type: QueueConnectionFactory for queues,
* and TopicConnectionFactory for topics.
*/
@Override
public void afterPropertiesSet() {
super.afterPropertiesSet();
@@ -149,6 +151,7 @@ public class JmsTemplate102 extends JmsTemplate {
* This implementation overrides the superclass method to accept either
* a QueueConnection or a TopicConnection, depending on the domain.
*/
@Override
protected Connection getConnection(JmsResourceHolder holder) {
return holder.getConnection(isPubSubDomain() ? (Class) TopicConnection.class : QueueConnection.class);
}
@@ -157,6 +160,7 @@ public class JmsTemplate102 extends JmsTemplate {
* This implementation overrides the superclass method to accept either
* a QueueSession or a TopicSession, depending on the domain.
*/
@Override
protected Session getSession(JmsResourceHolder holder) {
return holder.getSession(isPubSubDomain() ? (Class) TopicSession.class : QueueSession.class);
}
@@ -164,6 +168,7 @@ public class JmsTemplate102 extends JmsTemplate {
/**
* This implementation overrides the superclass method to use JMS 1.0.2 API.
*/
@Override
protected Connection createConnection() throws JMSException {
if (isPubSubDomain()) {
return ((TopicConnectionFactory) getConnectionFactory()).createTopicConnection();
@@ -176,6 +181,7 @@ public class JmsTemplate102 extends JmsTemplate {
/**
* This implementation overrides the superclass method to use JMS 1.0.2 API.
*/
@Override
protected Session createSession(Connection con) throws JMSException {
if (isPubSubDomain()) {
return ((TopicConnection) con).createTopicSession(isSessionTransacted(), getSessionAcknowledgeMode());
@@ -188,6 +194,7 @@ public class JmsTemplate102 extends JmsTemplate {
/**
* This implementation overrides the superclass method to use JMS 1.0.2 API.
*/
@Override
protected MessageProducer doCreateProducer(Session session, Destination destination) throws JMSException {
if (isPubSubDomain()) {
return ((TopicSession) session).createPublisher((Topic) destination);
@@ -200,6 +207,7 @@ public class JmsTemplate102 extends JmsTemplate {
/**
* This implementation overrides the superclass method to use JMS 1.0.2 API.
*/
@Override
protected MessageConsumer createConsumer(Session session, Destination destination, String messageSelector)
throws JMSException {
@@ -211,6 +219,7 @@ public class JmsTemplate102 extends JmsTemplate {
}
}
@Override
protected QueueBrowser createBrowser(Session session, Queue queue, String messageSelector)
throws JMSException {
@@ -225,6 +234,7 @@ public class JmsTemplate102 extends JmsTemplate {
/**
* This implementation overrides the superclass method to use JMS 1.0.2 API.
*/
@Override
protected void doSend(MessageProducer producer, Message message) throws JMSException {
if (isPubSubDomain()) {
if (isExplicitQosEnabled()) {
@@ -250,6 +260,7 @@ public class JmsTemplate102 extends JmsTemplate {
* The best we can do here is to check the setting on the template.
* @see #getSessionAcknowledgeMode()
*/
@Override
protected boolean isClientAcknowledge(Session session) throws JMSException {
return (getSessionAcknowledgeMode() == Session.CLIENT_ACKNOWLEDGE);
}

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

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

View File

@@ -50,6 +50,7 @@ public class DefaultMessageListenerContainer102 extends DefaultMessageListenerCo
* This implementation overrides the superclass method to accept either
* a QueueConnection or a TopicConnection, depending on the domain.
*/
@Override
protected Connection getConnection(JmsResourceHolder holder) {
return holder.getConnection(isPubSubDomain() ? TopicConnection.class : QueueConnection.class);
}
@@ -58,6 +59,7 @@ public class DefaultMessageListenerContainer102 extends DefaultMessageListenerCo
* This implementation overrides the superclass method to accept either
* a QueueSession or a TopicSession, depending on the domain.
*/
@Override
protected Session getSession(JmsResourceHolder holder) {
return holder.getSession(isPubSubDomain() ? TopicSession.class : QueueSession.class);
}
@@ -65,6 +67,7 @@ public class DefaultMessageListenerContainer102 extends DefaultMessageListenerCo
/**
* This implementation overrides the superclass method to use JMS 1.0.2 API.
*/
@Override
protected Connection createConnection() throws JMSException {
if (isPubSubDomain()) {
return ((TopicConnectionFactory) getConnectionFactory()).createTopicConnection();
@@ -77,6 +80,7 @@ public class DefaultMessageListenerContainer102 extends DefaultMessageListenerCo
/**
* This implementation overrides the superclass method to use JMS 1.0.2 API.
*/
@Override
protected Session createSession(Connection con) throws JMSException {
if (isPubSubDomain()) {
return ((TopicConnection) con).createTopicSession(isSessionTransacted(), getSessionAcknowledgeMode());
@@ -89,6 +93,7 @@ public class DefaultMessageListenerContainer102 extends DefaultMessageListenerCo
/**
* This implementation overrides the superclass method to use JMS 1.0.2 API.
*/
@Override
protected MessageConsumer createConsumer(Session session, Destination destination) throws JMSException {
if (isPubSubDomain()) {
if (isSubscriptionDurable()) {
@@ -110,6 +115,7 @@ public class DefaultMessageListenerContainer102 extends DefaultMessageListenerCo
* JMS 1.1's Session {@code getAcknowledgeMode()} method.
* The best we can do here is to check the setting on the listener container.
*/
@Override
protected boolean isClientAcknowledge(Session session) throws JMSException {
return (getSessionAcknowledgeMode() == Session.CLIENT_ACKNOWLEDGE);
}

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

@@ -47,6 +47,7 @@ public class SimpleMessageListenerContainer102 extends SimpleMessageListenerCont
/**
* This implementation overrides the superclass method to use JMS 1.0.2 API.
*/
@Override
protected Connection createConnection() throws JMSException {
if (isPubSubDomain()) {
return ((TopicConnectionFactory) getConnectionFactory()).createTopicConnection();
@@ -59,6 +60,7 @@ public class SimpleMessageListenerContainer102 extends SimpleMessageListenerCont
/**
* This implementation overrides the superclass method to use JMS 1.0.2 API.
*/
@Override
protected Session createSession(Connection con) throws JMSException {
if (isPubSubDomain()) {
return ((TopicConnection) con).createTopicSession(isSessionTransacted(), getSessionAcknowledgeMode());
@@ -71,6 +73,7 @@ public class SimpleMessageListenerContainer102 extends SimpleMessageListenerCont
/**
* This implementation overrides the superclass method to use JMS 1.0.2 API.
*/
@Override
protected MessageConsumer createConsumer(Session session, Destination destination) throws JMSException {
if (isPubSubDomain()) {
if (isSubscriptionDurable()) {
@@ -92,6 +95,7 @@ public class SimpleMessageListenerContainer102 extends SimpleMessageListenerCont
* JMS 1.1's Session {@code getAcknowledgeMode()} method.
* The best we can do here is to check the setting on the listener container.
*/
@Override
protected boolean isClientAcknowledge(Session session) throws JMSException {
return (getSessionAcknowledgeMode() == Session.CLIENT_ACKNOWLEDGE);
}

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

@@ -69,6 +69,7 @@ public class MessageListenerAdapter102 extends MessageListenerAdapter {
* @see #setMessageConverter
* @see org.springframework.jms.support.converter.SimpleMessageConverter102
*/
@Override
protected void initDefaultStrategies() {
setMessageConverter(new SimpleMessageConverter102());
}
@@ -78,6 +79,7 @@ public class MessageListenerAdapter102 extends MessageListenerAdapter {
* <p>Uses the JMS pub-sub API if the given destination is a topic,
* else uses the JMS queue API.
*/
@Override
protected void sendResponse(Session session, Destination destination, Message response) throws JMSException {
MessageProducer producer = null;
try {

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

@@ -146,6 +146,7 @@ public class MappingJacksonMessageConverter implements MessageConverter {
}
@Override
public Message toMessage(Object object, Session session) throws JMSException, MessageConversionException {
Message message;
try {
@@ -167,6 +168,7 @@ public class MappingJacksonMessageConverter implements MessageConverter {
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

@@ -50,6 +50,7 @@ public class SimpleMessageConverter102 extends SimpleMessageConverter {
* JMS 1.1 and is therefore not available on a JMS 1.0.2 provider.
* @see javax.jms.BytesMessage#getBodyLength()
*/
@Override
protected byte[] extractByteArrayFromMessage(BytesMessage message) throws JMSException {
ByteArrayOutputStream baos = new ByteArrayOutputStream(BUFFER_SIZE);
byte[] buffer = new byte[BUFFER_SIZE];

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();
}