提交 edbc1e92 编写于 作者: J Juergen Hoeller

Avoid outdated Tibco workaround in shouldCommitAfterNoMessageReceived

Issue: SPR-14697
上级 fa820bc0
/* /*
* 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"); * 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.
...@@ -91,8 +91,6 @@ public abstract class AbstractPollingMessageListenerContainer extends AbstractMe ...@@ -91,8 +91,6 @@ public abstract class AbstractPollingMessageListenerContainer extends AbstractMe
private long receiveTimeout = DEFAULT_RECEIVE_TIMEOUT; private long receiveTimeout = DEFAULT_RECEIVE_TIMEOUT;
private volatile Boolean commitAfterNoMessageReceived;
@Override @Override
public void setSessionTransacted(boolean sessionTransacted) { public void setSessionTransacted(boolean sessionTransacted) {
...@@ -347,7 +345,6 @@ public abstract class AbstractPollingMessageListenerContainer extends AbstractMe ...@@ -347,7 +345,6 @@ public abstract class AbstractPollingMessageListenerContainer extends AbstractMe
} }
noMessageReceived(invoker, sessionToUse); noMessageReceived(invoker, sessionToUse);
// Nevertheless call commit, in order to reset the transaction timeout (if any). // 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)) { if (shouldCommitAfterNoMessageReceived(sessionToUse)) {
commitIfNecessary(sessionToUse, message); commitIfNecessary(sessionToUse, message);
} }
...@@ -381,17 +378,12 @@ public abstract class AbstractPollingMessageListenerContainer extends AbstractMe ...@@ -381,17 +378,12 @@ public abstract class AbstractPollingMessageListenerContainer extends AbstractMe
/** /**
* Determine whether to trigger a commit after no message has been received. * 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 is a good idea on any modern-day JMS provider.
* this default implementation checks for.
* @param session the current JMS Session which received no message * @param session the current JMS Session which received no message
* @return whether to call {@link #commitIfNecessary} on the given Session * @return whether to call {@link #commitIfNecessary} on the given Session
*/ */
protected boolean shouldCommitAfterNoMessageReceived(Session session) { protected boolean shouldCommitAfterNoMessageReceived(Session session) {
if (this.commitAfterNoMessageReceived == null) { return true;
Session target = ConnectionFactoryUtils.getTargetSession(session);
this.commitAfterNoMessageReceived = !target.getClass().getName().startsWith("com.tibco.tibjms.");
}
return this.commitAfterNoMessageReceived;
} }
/** /**
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册