Skip to content

Commit 3be190d

Browse files
committed
Consistent removal of JMS 1.0.2 references
1 parent a9100c4 commit 3be190d

File tree

9 files changed

+28
-104
lines changed

9 files changed

+28
-104
lines changed

spring-jms/src/main/java/org/springframework/jms/connection/JmsTransactionManager.java

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2013 the original author or authors.
2+
* Copyright 2002-2014 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -270,10 +270,6 @@ protected void doCleanupAfterCompletion(Object transaction) {
270270
}
271271

272272

273-
//-------------------------------------------------------------------------
274-
// JMS 1.1 factory methods, potentially overridden for JMS 1.0.2
275-
//-------------------------------------------------------------------------
276-
277273
/**
278274
* Create a JMS Connection via this template's ConnectionFactory.
279275
* <p>This implementation uses JMS 1.1 API.

spring-jms/src/main/java/org/springframework/jms/connection/SingleConnectionFactory.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2013 the original author or authors.
2+
* Copyright 2002-2014 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -393,7 +393,7 @@ protected Session getSession(Connection con, Integer mode) throws JMSException {
393393

394394
/**
395395
* Create a default Session for this ConnectionFactory,
396-
* adaptign to JMS 1.0.2 style queue/topic mode if necessary.
396+
* adapting to JMS 1.0.2 style queue/topic mode if necessary.
397397
* @param con the JMS Connection to operate on
398398
* @param mode the Session acknowledgement mode
399399
* ({@code Session.TRANSACTED} or one of the common modes)

spring-jms/src/main/java/org/springframework/jms/core/JmsOperations.java

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2012 the original author or authors.
2+
* Copyright 2002-2014 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -45,9 +45,6 @@ public interface JmsOperations {
4545

4646
/**
4747
* Execute the action specified by the given action object within a JMS Session.
48-
* <p>When used with a 1.0.2 provider, you may need to downcast
49-
* to the appropriate domain implementation, either QueueSession or
50-
* TopicSession in the action objects doInJms callback method.
5148
* @param action callback object that exposes the session
5249
* @return the result object from working with the session
5350
* @throws JmsException if there is any problem

spring-jms/src/main/java/org/springframework/jms/core/JmsTemplate.java

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2013 the original author or authors.
2+
* Copyright 2002-2014 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -295,7 +295,7 @@ public boolean isMessageTimestampEnabled() {
295295
/**
296296
* Set whether to inhibit the delivery of messages published by its own connection.
297297
* Default is "false".
298-
* @see javax.jms.TopicSession#createSubscriber(javax.jms.Topic, String, boolean)
298+
* @see javax.jms.Session#createConsumer(javax.jms.Destination, String, boolean)
299299
*/
300300
public void setPubSubNoLocal(boolean pubSubNoLocal) {
301301
this.pubSubNoLocal = pubSubNoLocal;
@@ -966,10 +966,6 @@ public T doInJms(Session session) throws JMSException {
966966
}
967967

968968

969-
//-------------------------------------------------------------------------
970-
// JMS 1.1 factory methods, potentially overridden for JMS 1.0.2
971-
//-------------------------------------------------------------------------
972-
973969
/**
974970
* Fetch an appropriate Connection from the given JmsResourceHolder.
975971
* <p>This implementation accepts any JMS 1.1 Connection.
@@ -1013,7 +1009,7 @@ protected boolean isSessionLocallyTransacted(Session session) {
10131009
* Create a JMS MessageProducer for the given Session and Destination,
10141010
* configuring it to disable message ids and/or timestamps (if necessary).
10151011
* <p>Delegates to {@link #doCreateProducer} for creation of the raw
1016-
* JMS MessageProducer, which needs to be specific to JMS 1.1 or 1.0.2.
1012+
* JMS MessageProducer.
10171013
* @param session the JMS Session to create a MessageProducer for
10181014
* @param destination the JMS Destination to create a MessageProducer for
10191015
* @return the new JMS MessageProducer
@@ -1071,7 +1067,7 @@ protected MessageConsumer createConsumer(Session session, Destination destinatio
10711067
* Create a JMS MessageProducer for the given Session and Destination,
10721068
* configuring it to disable message ids and/or timestamps (if necessary).
10731069
* <p>Delegates to {@link #doCreateProducer} for creation of the raw
1074-
* JMS MessageProducer, which needs to be specific to JMS 1.1 or 1.0.2.
1070+
* JMS MessageProducer.
10751071
* @param session the JMS Session to create a QueueBrowser for
10761072
* @param queue the JMS Queue to create a QueueBrowser for
10771073
* @param messageSelector the message selector for this consumer (can be {@code null})

spring-jms/src/main/java/org/springframework/jms/core/ProducerCallback.java

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2012 the original author or authors.
2+
* Copyright 2002-2014 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -27,10 +27,7 @@
2727
* argument, often implemented as an anonymous inner class.
2828
*
2929
* <p>The typical implementation will perform multiple operations on the
30-
* supplied JMS {@link Session} and {@link MessageProducer}. When used with
31-
* a 1.0.2 provider, you need to downcast to the appropriate domain
32-
* implementation, either {@link javax.jms.QueueSender} or
33-
* {@link javax.jms.TopicPublisher}, to actually send a message.
30+
* supplied JMS {@link Session} and {@link MessageProducer}.
3431
*
3532
* @author Mark Pollack
3633
* @since 1.1

spring-jms/src/main/java/org/springframework/jms/remoting/JmsInvokerClientInterceptor.java

Lines changed: 8 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2012 the original author or authors.
2+
* Copyright 2002-2014 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -24,10 +24,6 @@
2424
import javax.jms.MessageFormatException;
2525
import javax.jms.MessageProducer;
2626
import javax.jms.Queue;
27-
import javax.jms.QueueConnection;
28-
import javax.jms.QueueConnectionFactory;
29-
import javax.jms.QueueSender;
30-
import javax.jms.QueueSession;
3127
import javax.jms.Session;
3228
import javax.jms.TemporaryQueue;
3329

@@ -48,7 +44,6 @@
4844
import org.springframework.remoting.support.RemoteInvocation;
4945
import org.springframework.remoting.support.RemoteInvocationFactory;
5046
import org.springframework.remoting.support.RemoteInvocationResult;
51-
import org.springframework.util.ClassUtils;
5247

5348
/**
5449
* {@link org.aopalliance.intercept.MethodInterceptor} for accessing a
@@ -75,8 +70,6 @@
7570
*/
7671
public class JmsInvokerClientInterceptor implements MethodInterceptor, InitializingBean {
7772

78-
private static final boolean jms11Available = ClassUtils.hasMethod(ConnectionFactory.class, "createConnection");
79-
8073
private ConnectionFactory connectionFactory;
8174

8275
private Object queue;
@@ -263,25 +256,14 @@ protected RemoteInvocationResult executeRequest(RemoteInvocation invocation) thr
263256
* Create a new JMS Connection for this JMS invoker.
264257
*/
265258
protected Connection createConnection() throws JMSException {
266-
ConnectionFactory cf = getConnectionFactory();
267-
if (jms11Available) {
268-
return cf.createConnection();
269-
}
270-
else {
271-
return ((QueueConnectionFactory) cf).createQueueConnection();
272-
}
259+
return getConnectionFactory().createConnection();
273260
}
274261

275262
/**
276263
* Create a new JMS Session for this JMS invoker.
277264
*/
278265
protected Session createSession(Connection con) throws JMSException {
279-
if (jms11Available) {
280-
return con.createSession(false, Session.AUTO_ACKNOWLEDGE);
281-
}
282-
else {
283-
return ((QueueConnection) con).createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
284-
}
266+
return con.createSession(false, Session.AUTO_ACKNOWLEDGE);
285267
}
286268

287269
/**
@@ -345,25 +327,11 @@ protected Message doExecuteRequest(Session session, Queue queue, Message request
345327
MessageProducer producer = null;
346328
MessageConsumer consumer = null;
347329
try {
348-
if (jms11Available) {
349-
// Standard JMS 1.1 API usage...
350-
responseQueue = session.createTemporaryQueue();
351-
producer = session.createProducer(queue);
352-
consumer = session.createConsumer(responseQueue);
353-
requestMessage.setJMSReplyTo(responseQueue);
354-
producer.send(requestMessage);
355-
}
356-
else {
357-
// Perform all calls on QueueSession reference for JMS 1.0.2 compatibility...
358-
// DEPRECATED but kept around with the deprecated JmsTemplate102 etc classes for the time being.
359-
QueueSession queueSession = (QueueSession) session;
360-
responseQueue = queueSession.createTemporaryQueue();
361-
QueueSender sender = queueSession.createSender(queue);
362-
producer = sender;
363-
consumer = queueSession.createReceiver(responseQueue);
364-
requestMessage.setJMSReplyTo(responseQueue);
365-
sender.send(requestMessage);
366-
}
330+
responseQueue = session.createTemporaryQueue();
331+
producer = session.createProducer(queue);
332+
consumer = session.createConsumer(responseQueue);
333+
requestMessage.setJMSReplyTo(responseQueue);
334+
producer.send(requestMessage);
367335
long timeout = getReceiveTimeout();
368336
return (timeout > 0 ? consumer.receive(timeout) : consumer.receive());
369337
}

spring-jms/src/main/java/org/springframework/jms/support/JmsAccessor.java

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2012 the original author or authors.
2+
* Copyright 2002-2014 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -109,7 +109,7 @@ public boolean isSessionTransacted() {
109109
* Set the JMS acknowledgement mode by the name of the corresponding constant
110110
* in the JMS {@link Session} interface, e.g. "CLIENT_ACKNOWLEDGE".
111111
* <p>If you want to use vendor-specific extensions to the acknowledgment mode,
112-
* use {@link #setSessionAcknowledgeModeName(String)} instead.
112+
* use {@link #setSessionAcknowledgeMode(int)} instead.
113113
* @param constantName the name of the {@link Session} acknowledge mode constant
114114
* @see javax.jms.Session#AUTO_ACKNOWLEDGE
115115
* @see javax.jms.Session#CLIENT_ACKNOWLEDGE
@@ -125,8 +125,8 @@ public void setSessionAcknowledgeModeName(String constantName) {
125125
* {@link Session} to send a message.
126126
* <p>Default is {@link Session#AUTO_ACKNOWLEDGE}.
127127
* <p>Vendor-specific extensions to the acknowledgment mode can be set here as well.
128-
* <p>Note that that inside an EJB the parameters to
129-
* create(Queue/Topic)Session(boolean transacted, int acknowledgeMode) method
128+
* <p>Note that that inside an EJB, the parameters to the
129+
* {@code create(Queue/Topic)Session(boolean transacted, int acknowledgeMode)} method
130130
* are not taken into account. Depending on the transaction context in the EJB,
131131
* the container makes its own decisions on these values. See section 17.3.5
132132
* of the EJB spec.
@@ -169,11 +169,6 @@ protected JmsException convertJmsAccessException(JMSException ex) {
169169
return JmsUtils.convertJmsAccessException(ex);
170170
}
171171

172-
173-
//-------------------------------------------------------------------------
174-
// JMS 1.1 factory methods, potentially overridden for JMS 1.0.2
175-
//-------------------------------------------------------------------------
176-
177172
/**
178173
* Create a JMS Connection via this template's ConnectionFactory.
179174
* <p>This implementation uses JMS 1.1 API.

spring-jms/src/main/java/org/springframework/jms/support/destination/DynamicDestinationResolver.java

Lines changed: 3 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2012 the original author or authors.
2+
* Copyright 2002-2014 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -19,26 +19,17 @@
1919
import javax.jms.Destination;
2020
import javax.jms.JMSException;
2121
import javax.jms.Queue;
22-
import javax.jms.QueueSession;
2322
import javax.jms.Session;
2423
import javax.jms.Topic;
25-
import javax.jms.TopicSession;
2624

2725
import org.springframework.util.Assert;
2826

2927
/**
3028
* Simple {@link DestinationResolver} implementation resolving destination names
3129
* as dynamic destinations.
3230
*
33-
* <p>This implementation will work on both JMS 1.1 and JMS 1.0.2,
34-
* because it uses the {@link javax.jms.QueueSession} or {@link javax.jms.TopicSession}
35-
* methods if possible, falling back to JMS 1.1's generic {@link javax.jms.Session}
36-
* methods.
37-
*
3831
* @author Juergen Hoeller
3932
* @since 1.1
40-
* @see javax.jms.QueueSession#createQueue
41-
* @see javax.jms.TopicSession#createTopic
4233
* @see javax.jms.Session#createQueue
4334
* @see javax.jms.Session#createTopic
4435
*/
@@ -78,14 +69,7 @@ public Destination resolveDestinationName(Session session, String destinationNam
7869
* @see Session#createTopic(String)
7970
*/
8071
protected Topic resolveTopic(Session session, String topicName) throws JMSException {
81-
if (session instanceof TopicSession) {
82-
// Cast to TopicSession: will work on both JMS 1.1 and 1.0.2
83-
return ((TopicSession) session).createTopic(topicName);
84-
}
85-
else {
86-
// Fall back to generic JMS Session: will only work on JMS 1.1
87-
return session.createTopic(topicName);
88-
}
72+
return session.createTopic(topicName);
8973
}
9074

9175
/**
@@ -97,14 +81,7 @@ protected Topic resolveTopic(Session session, String topicName) throws JMSExcept
9781
* @see Session#createQueue(String)
9882
*/
9983
protected Queue resolveQueue(Session session, String queueName) throws JMSException {
100-
if (session instanceof QueueSession) {
101-
// Cast to QueueSession: will work on both JMS 1.1 and 1.0.2
102-
return ((QueueSession) session).createQueue(queueName);
103-
}
104-
else {
105-
// Fall back to generic JMS Session: will only work on JMS 1.1
106-
return session.createQueue(queueName);
107-
}
84+
return session.createQueue(queueName);
10885
}
10986

11087
}

spring-jms/src/main/java/org/springframework/jms/support/destination/JmsDestinationAccessor.java

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2012 the original author or authors.
2+
* Copyright 2002-2014 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -66,10 +66,8 @@ public DestinationResolver getDestinationResolver() {
6666
/**
6767
* Configure the destination accessor with knowledge of the JMS domain used.
6868
* Default is Point-to-Point (Queues).
69-
* <p>For JMS 1.0.2 based accessors, this tells the JMS provider which class hierarchy
70-
* to use in the implementation of its operations. For JMS 1.1 based accessors, this
71-
* setting does usually not affect operations. However, for both JMS versions, this
72-
* setting tells what type of destination to resolve if dynamic destinations are enabled.
69+
* <p>This setting primarily indicates what type of destination to resolve
70+
* if dynamic destinations are enabled.
7371
* @param pubSubDomain "true" for the Publish/Subscribe domain ({@link javax.jms.Topic Topics}),
7472
* "false" for the Point-to-Point domain ({@link javax.jms.Queue Queues})
7573
* @see #setDestinationResolver

0 commit comments

Comments
 (0)