Consistent removal of JMS 1.0.2 references
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2013 the original author or authors.
|
||||
* Copyright 2002-2014 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -270,10 +270,6 @@ public class JmsTransactionManager extends AbstractPlatformTransactionManager
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
// JMS 1.1 factory methods, potentially overridden for JMS 1.0.2
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Create a JMS Connection via this template's ConnectionFactory.
|
||||
* <p>This implementation uses JMS 1.1 API.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2013 the original author or authors.
|
||||
* Copyright 2002-2014 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -393,7 +393,7 @@ public class SingleConnectionFactory
|
||||
|
||||
/**
|
||||
* Create a default Session for this ConnectionFactory,
|
||||
* adaptign to JMS 1.0.2 style queue/topic mode if necessary.
|
||||
* adapting to JMS 1.0.2 style queue/topic mode if necessary.
|
||||
* @param con the JMS Connection to operate on
|
||||
* @param mode the Session acknowledgement mode
|
||||
* ({@code Session.TRANSACTED} or one of the common modes)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2012 the original author or authors.
|
||||
* Copyright 2002-2014 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -45,9 +45,6 @@ public interface JmsOperations {
|
||||
|
||||
/**
|
||||
* Execute the action specified by the given action object within a JMS Session.
|
||||
* <p>When used with a 1.0.2 provider, you may need to downcast
|
||||
* to the appropriate domain implementation, either QueueSession or
|
||||
* TopicSession in the action objects doInJms callback method.
|
||||
* @param action callback object that exposes the session
|
||||
* @return the result object from working with the session
|
||||
* @throws JmsException if there is any problem
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2013 the original author or authors.
|
||||
* Copyright 2002-2014 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -295,7 +295,7 @@ public class JmsTemplate extends JmsDestinationAccessor implements JmsOperations
|
||||
/**
|
||||
* Set whether to inhibit the delivery of messages published by its own connection.
|
||||
* Default is "false".
|
||||
* @see javax.jms.TopicSession#createSubscriber(javax.jms.Topic, String, boolean)
|
||||
* @see javax.jms.Session#createConsumer(javax.jms.Destination, String, boolean)
|
||||
*/
|
||||
public void setPubSubNoLocal(boolean pubSubNoLocal) {
|
||||
this.pubSubNoLocal = pubSubNoLocal;
|
||||
@@ -966,10 +966,6 @@ public class JmsTemplate extends JmsDestinationAccessor implements JmsOperations
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
// JMS 1.1 factory methods, potentially overridden for JMS 1.0.2
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Fetch an appropriate Connection from the given JmsResourceHolder.
|
||||
* <p>This implementation accepts any JMS 1.1 Connection.
|
||||
@@ -1013,7 +1009,7 @@ public class JmsTemplate extends JmsDestinationAccessor implements JmsOperations
|
||||
* Create a JMS MessageProducer for the given Session and Destination,
|
||||
* configuring it to disable message ids and/or timestamps (if necessary).
|
||||
* <p>Delegates to {@link #doCreateProducer} for creation of the raw
|
||||
* JMS MessageProducer, which needs to be specific to JMS 1.1 or 1.0.2.
|
||||
* JMS MessageProducer.
|
||||
* @param session the JMS Session to create a MessageProducer for
|
||||
* @param destination the JMS Destination to create a MessageProducer for
|
||||
* @return the new JMS MessageProducer
|
||||
@@ -1071,7 +1067,7 @@ public class JmsTemplate extends JmsDestinationAccessor implements JmsOperations
|
||||
* Create a JMS MessageProducer for the given Session and Destination,
|
||||
* configuring it to disable message ids and/or timestamps (if necessary).
|
||||
* <p>Delegates to {@link #doCreateProducer} for creation of the raw
|
||||
* JMS MessageProducer, which needs to be specific to JMS 1.1 or 1.0.2.
|
||||
* JMS MessageProducer.
|
||||
* @param session the JMS Session to create a QueueBrowser for
|
||||
* @param queue the JMS Queue to create a QueueBrowser for
|
||||
* @param messageSelector the message selector for this consumer (can be {@code null})
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2012 the original author or authors.
|
||||
* Copyright 2002-2014 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -27,10 +27,7 @@ import javax.jms.Session;
|
||||
* argument, often implemented as an anonymous inner class.
|
||||
*
|
||||
* <p>The typical implementation will perform multiple operations on the
|
||||
* supplied JMS {@link Session} and {@link MessageProducer}. When used with
|
||||
* a 1.0.2 provider, you need to downcast to the appropriate domain
|
||||
* implementation, either {@link javax.jms.QueueSender} or
|
||||
* {@link javax.jms.TopicPublisher}, to actually send a message.
|
||||
* supplied JMS {@link Session} and {@link MessageProducer}.
|
||||
*
|
||||
* @author Mark Pollack
|
||||
* @since 1.1
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2012 the original author or authors.
|
||||
* Copyright 2002-2014 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -24,10 +24,6 @@ import javax.jms.MessageConsumer;
|
||||
import javax.jms.MessageFormatException;
|
||||
import javax.jms.MessageProducer;
|
||||
import javax.jms.Queue;
|
||||
import javax.jms.QueueConnection;
|
||||
import javax.jms.QueueConnectionFactory;
|
||||
import javax.jms.QueueSender;
|
||||
import javax.jms.QueueSession;
|
||||
import javax.jms.Session;
|
||||
import javax.jms.TemporaryQueue;
|
||||
|
||||
@@ -48,7 +44,6 @@ import org.springframework.remoting.support.DefaultRemoteInvocationFactory;
|
||||
import org.springframework.remoting.support.RemoteInvocation;
|
||||
import org.springframework.remoting.support.RemoteInvocationFactory;
|
||||
import org.springframework.remoting.support.RemoteInvocationResult;
|
||||
import org.springframework.util.ClassUtils;
|
||||
|
||||
/**
|
||||
* {@link org.aopalliance.intercept.MethodInterceptor} for accessing a
|
||||
@@ -75,8 +70,6 @@ import org.springframework.util.ClassUtils;
|
||||
*/
|
||||
public class JmsInvokerClientInterceptor implements MethodInterceptor, InitializingBean {
|
||||
|
||||
private static final boolean jms11Available = ClassUtils.hasMethod(ConnectionFactory.class, "createConnection");
|
||||
|
||||
private ConnectionFactory connectionFactory;
|
||||
|
||||
private Object queue;
|
||||
@@ -263,25 +256,14 @@ public class JmsInvokerClientInterceptor implements MethodInterceptor, Initializ
|
||||
* Create a new JMS Connection for this JMS invoker.
|
||||
*/
|
||||
protected Connection createConnection() throws JMSException {
|
||||
ConnectionFactory cf = getConnectionFactory();
|
||||
if (jms11Available) {
|
||||
return cf.createConnection();
|
||||
}
|
||||
else {
|
||||
return ((QueueConnectionFactory) cf).createQueueConnection();
|
||||
}
|
||||
return getConnectionFactory().createConnection();
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new JMS Session for this JMS invoker.
|
||||
*/
|
||||
protected Session createSession(Connection con) throws JMSException {
|
||||
if (jms11Available) {
|
||||
return con.createSession(false, Session.AUTO_ACKNOWLEDGE);
|
||||
}
|
||||
else {
|
||||
return ((QueueConnection) con).createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
|
||||
}
|
||||
return con.createSession(false, Session.AUTO_ACKNOWLEDGE);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -345,25 +327,11 @@ public class JmsInvokerClientInterceptor implements MethodInterceptor, Initializ
|
||||
MessageProducer producer = null;
|
||||
MessageConsumer consumer = null;
|
||||
try {
|
||||
if (jms11Available) {
|
||||
// Standard JMS 1.1 API usage...
|
||||
responseQueue = session.createTemporaryQueue();
|
||||
producer = session.createProducer(queue);
|
||||
consumer = session.createConsumer(responseQueue);
|
||||
requestMessage.setJMSReplyTo(responseQueue);
|
||||
producer.send(requestMessage);
|
||||
}
|
||||
else {
|
||||
// Perform all calls on QueueSession reference for JMS 1.0.2 compatibility...
|
||||
// DEPRECATED but kept around with the deprecated JmsTemplate102 etc classes for the time being.
|
||||
QueueSession queueSession = (QueueSession) session;
|
||||
responseQueue = queueSession.createTemporaryQueue();
|
||||
QueueSender sender = queueSession.createSender(queue);
|
||||
producer = sender;
|
||||
consumer = queueSession.createReceiver(responseQueue);
|
||||
requestMessage.setJMSReplyTo(responseQueue);
|
||||
sender.send(requestMessage);
|
||||
}
|
||||
responseQueue = session.createTemporaryQueue();
|
||||
producer = session.createProducer(queue);
|
||||
consumer = session.createConsumer(responseQueue);
|
||||
requestMessage.setJMSReplyTo(responseQueue);
|
||||
producer.send(requestMessage);
|
||||
long timeout = getReceiveTimeout();
|
||||
return (timeout > 0 ? consumer.receive(timeout) : consumer.receive());
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2012 the original author or authors.
|
||||
* Copyright 2002-2014 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -109,7 +109,7 @@ public abstract class JmsAccessor implements InitializingBean {
|
||||
* Set the JMS acknowledgement mode by the name of the corresponding constant
|
||||
* in the JMS {@link Session} interface, e.g. "CLIENT_ACKNOWLEDGE".
|
||||
* <p>If you want to use vendor-specific extensions to the acknowledgment mode,
|
||||
* use {@link #setSessionAcknowledgeModeName(String)} instead.
|
||||
* use {@link #setSessionAcknowledgeMode(int)} instead.
|
||||
* @param constantName the name of the {@link Session} acknowledge mode constant
|
||||
* @see javax.jms.Session#AUTO_ACKNOWLEDGE
|
||||
* @see javax.jms.Session#CLIENT_ACKNOWLEDGE
|
||||
@@ -125,8 +125,8 @@ public abstract class JmsAccessor implements InitializingBean {
|
||||
* {@link Session} to send a message.
|
||||
* <p>Default is {@link Session#AUTO_ACKNOWLEDGE}.
|
||||
* <p>Vendor-specific extensions to the acknowledgment mode can be set here as well.
|
||||
* <p>Note that that inside an EJB the parameters to
|
||||
* create(Queue/Topic)Session(boolean transacted, int acknowledgeMode) method
|
||||
* <p>Note that that inside an EJB, the parameters to the
|
||||
* {@code create(Queue/Topic)Session(boolean transacted, int acknowledgeMode)} method
|
||||
* are not taken into account. Depending on the transaction context in the EJB,
|
||||
* the container makes its own decisions on these values. See section 17.3.5
|
||||
* of the EJB spec.
|
||||
@@ -169,11 +169,6 @@ public abstract class JmsAccessor implements InitializingBean {
|
||||
return JmsUtils.convertJmsAccessException(ex);
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
// JMS 1.1 factory methods, potentially overridden for JMS 1.0.2
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Create a JMS Connection via this template's ConnectionFactory.
|
||||
* <p>This implementation uses JMS 1.1 API.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2012 the original author or authors.
|
||||
* Copyright 2002-2014 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -19,10 +19,8 @@ package org.springframework.jms.support.destination;
|
||||
import javax.jms.Destination;
|
||||
import javax.jms.JMSException;
|
||||
import javax.jms.Queue;
|
||||
import javax.jms.QueueSession;
|
||||
import javax.jms.Session;
|
||||
import javax.jms.Topic;
|
||||
import javax.jms.TopicSession;
|
||||
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
@@ -30,15 +28,8 @@ import org.springframework.util.Assert;
|
||||
* Simple {@link DestinationResolver} implementation resolving destination names
|
||||
* as dynamic destinations.
|
||||
*
|
||||
* <p>This implementation will work on both JMS 1.1 and JMS 1.0.2,
|
||||
* because it uses the {@link javax.jms.QueueSession} or {@link javax.jms.TopicSession}
|
||||
* methods if possible, falling back to JMS 1.1's generic {@link javax.jms.Session}
|
||||
* methods.
|
||||
*
|
||||
* @author Juergen Hoeller
|
||||
* @since 1.1
|
||||
* @see javax.jms.QueueSession#createQueue
|
||||
* @see javax.jms.TopicSession#createTopic
|
||||
* @see javax.jms.Session#createQueue
|
||||
* @see javax.jms.Session#createTopic
|
||||
*/
|
||||
@@ -78,14 +69,7 @@ public class DynamicDestinationResolver implements DestinationResolver {
|
||||
* @see Session#createTopic(String)
|
||||
*/
|
||||
protected Topic resolveTopic(Session session, String topicName) throws JMSException {
|
||||
if (session instanceof TopicSession) {
|
||||
// Cast to TopicSession: will work on both JMS 1.1 and 1.0.2
|
||||
return ((TopicSession) session).createTopic(topicName);
|
||||
}
|
||||
else {
|
||||
// Fall back to generic JMS Session: will only work on JMS 1.1
|
||||
return session.createTopic(topicName);
|
||||
}
|
||||
return session.createTopic(topicName);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -97,14 +81,7 @@ public class DynamicDestinationResolver implements DestinationResolver {
|
||||
* @see Session#createQueue(String)
|
||||
*/
|
||||
protected Queue resolveQueue(Session session, String queueName) throws JMSException {
|
||||
if (session instanceof QueueSession) {
|
||||
// Cast to QueueSession: will work on both JMS 1.1 and 1.0.2
|
||||
return ((QueueSession) session).createQueue(queueName);
|
||||
}
|
||||
else {
|
||||
// Fall back to generic JMS Session: will only work on JMS 1.1
|
||||
return session.createQueue(queueName);
|
||||
}
|
||||
return session.createQueue(queueName);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2012 the original author or authors.
|
||||
* Copyright 2002-2014 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -66,10 +66,8 @@ public abstract class JmsDestinationAccessor extends JmsAccessor {
|
||||
/**
|
||||
* Configure the destination accessor with knowledge of the JMS domain used.
|
||||
* Default is Point-to-Point (Queues).
|
||||
* <p>For JMS 1.0.2 based accessors, this tells the JMS provider which class hierarchy
|
||||
* to use in the implementation of its operations. For JMS 1.1 based accessors, this
|
||||
* setting does usually not affect operations. However, for both JMS versions, this
|
||||
* setting tells what type of destination to resolve if dynamic destinations are enabled.
|
||||
* <p>This setting primarily indicates what type of destination to resolve
|
||||
* if dynamic destinations are enabled.
|
||||
* @param pubSubDomain "true" for the Publish/Subscribe domain ({@link javax.jms.Topic Topics}),
|
||||
* "false" for the Point-to-Point domain ({@link javax.jms.Queue Queues})
|
||||
* @see #setDestinationResolver
|
||||
|
||||
Reference in New Issue
Block a user