JmsTemplate uses configured receiveTimeout if shorter than remaining transaction timeout

Issue: SPR-10109
This commit is contained in:
Juergen Hoeller 2012-12-19 21:42:37 +01:00
parent b73a7a8410
commit d3da2edf18
1 changed files with 2 additions and 2 deletions

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2009 the original author or authors.
* Copyright 2002-2012 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.
@ -736,7 +736,7 @@ public class JmsTemplate extends JmsDestinationAccessor implements JmsOperations
JmsResourceHolder resourceHolder =
(JmsResourceHolder) TransactionSynchronizationManager.getResource(getConnectionFactory());
if (resourceHolder != null && resourceHolder.hasTimeout()) {
timeout = resourceHolder.getTimeToLiveInMillis();
timeout = Math.min(timeout, resourceHolder.getTimeToLiveInMillis());
}
Message message = doReceive(consumer, timeout);
if (session.getTransacted()) {