Skip to content

Commit d3da2ed

Browse files
committed
JmsTemplate uses configured receiveTimeout if shorter than remaining transaction timeout
Issue: SPR-10109
1 parent b73a7a8 commit d3da2ed

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2009 the original author or authors.
2+
* Copyright 2002-2012 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.
@@ -736,7 +736,7 @@ protected Message doReceive(Session session, MessageConsumer consumer) throws JM
736736
JmsResourceHolder resourceHolder =
737737
(JmsResourceHolder) TransactionSynchronizationManager.getResource(getConnectionFactory());
738738
if (resourceHolder != null && resourceHolder.hasTimeout()) {
739-
timeout = resourceHolder.getTimeToLiveInMillis();
739+
timeout = Math.min(timeout, resourceHolder.getTimeToLiveInMillis());
740740
}
741741
Message message = doReceive(consumer, timeout);
742742
if (session.getTransacted()) {

0 commit comments

Comments
 (0)