From edbc1e92129f659b9c59722611065befa705e2fe Mon Sep 17 00:00:00 2001 From: Juergen Hoeller Date: Tue, 13 Sep 2016 21:34:47 +0200 Subject: [PATCH] Avoid outdated Tibco workaround in shouldCommitAfterNoMessageReceived Issue: SPR-14697 --- .../AbstractPollingMessageListenerContainer.java | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/spring-jms/src/main/java/org/springframework/jms/listener/AbstractPollingMessageListenerContainer.java b/spring-jms/src/main/java/org/springframework/jms/listener/AbstractPollingMessageListenerContainer.java index 555cd6b8c3..910125f80a 100644 --- a/spring-jms/src/main/java/org/springframework/jms/listener/AbstractPollingMessageListenerContainer.java +++ b/spring-jms/src/main/java/org/springframework/jms/listener/AbstractPollingMessageListenerContainer.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2015 the original author or authors. + * Copyright 2002-2016 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. @@ -91,8 +91,6 @@ public abstract class AbstractPollingMessageListenerContainer extends AbstractMe private long receiveTimeout = DEFAULT_RECEIVE_TIMEOUT; - private volatile Boolean commitAfterNoMessageReceived; - @Override public void setSessionTransacted(boolean sessionTransacted) { @@ -347,7 +345,6 @@ public abstract class AbstractPollingMessageListenerContainer extends AbstractMe } noMessageReceived(invoker, sessionToUse); // Nevertheless call commit, in order to reset the transaction timeout (if any). - // However, don't do this on Tibco since this may lead to a deadlock there. if (shouldCommitAfterNoMessageReceived(sessionToUse)) { commitIfNecessary(sessionToUse, message); } @@ -381,17 +378,12 @@ public abstract class AbstractPollingMessageListenerContainer extends AbstractMe /** * Determine whether to trigger a commit after no message has been received. - * This is a good idea on any JMS provider other than Tibco, which is what - * this default implementation checks for. + * This is a good idea on any modern-day JMS provider. * @param session the current JMS Session which received no message * @return whether to call {@link #commitIfNecessary} on the given Session */ protected boolean shouldCommitAfterNoMessageReceived(Session session) { - if (this.commitAfterNoMessageReceived == null) { - Session target = ConnectionFactoryUtils.getTargetSession(session); - this.commitAfterNoMessageReceived = !target.getClass().getName().startsWith("com.tibco.tibjms."); - } - return this.commitAfterNoMessageReceived; + return true; } /**