Skip to content

Commit

Permalink
Avoid outdated Tibco workaround in shouldCommitAfterNoMessageReceived
Browse files Browse the repository at this point in the history
Issue: SPR-14697
  • Loading branch information
jhoeller committed Sep 13, 2016
1 parent fa820bc commit edbc1e9
Showing 1 changed file with 3 additions and 11 deletions.
@@ -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.
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -347,7 +345,6 @@ protected boolean doReceiveAndExecute(
}
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);
}
Expand Down Expand Up @@ -381,17 +378,12 @@ protected boolean isSessionLocallyTransacted(Session session) {

/**
* 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;
}

/**
Expand Down

0 comments on commit edbc1e9

Please sign in to comment.