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:58 +01:00
parent 778693f9f8
commit 39fe8eebb1

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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with 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 resourceHolder =
(JmsResourceHolder) TransactionSynchronizationManager.getResource(getConnectionFactory()); (JmsResourceHolder) TransactionSynchronizationManager.getResource(getConnectionFactory());
if (resourceHolder != null && resourceHolder.hasTimeout()) { if (resourceHolder != null && resourceHolder.hasTimeout()) {
timeout = resourceHolder.getTimeToLiveInMillis(); timeout = Math.min(timeout, resourceHolder.getTimeToLiveInMillis());
} }
Message message = doReceive(consumer, timeout); Message message = doReceive(consumer, timeout);
if (session.getTransacted()) { if (session.getTransacted()) {