https://issues.apache.org/jira/browse/AMQ-5384 - apply variant of patch from Tomasz Skorka with thanks

This commit is contained in:
gtully 2014-10-07 15:54:21 +01:00
parent b5581166be
commit ad770ea79d
2 changed files with 4 additions and 7 deletions

View File

@ -248,7 +248,7 @@ public class JDBCMessageStore extends AbstractMessageStore {
long seq = ack.getLastMessageId().getFutureOrSequenceLong() != null ?
(Long) ack.getLastMessageId().getFutureOrSequenceLong() :
persistenceAdapter.getStoreSequenceIdForMessageId(ack.getLastMessageId(), destination)[0];
persistenceAdapter.getStoreSequenceIdForMessageId(context, ack.getLastMessageId(), destination)[0];
// Get a connection and remove the message from the DB
TransactionContext c = persistenceAdapter.getTransactionContext(context);
@ -260,9 +260,6 @@ public class JDBCMessageStore extends AbstractMessageStore {
} finally {
c.close();
}
//if (context != null && context.getXid() != null) {
// ack.getLastMessageId().setEntryLocator(seq);
//}
}
public void recover(final MessageRecoveryListener listener) throws Exception {
@ -389,7 +386,7 @@ public class JDBCMessageStore extends AbstractMessageStore {
@Override
public void setBatch(MessageId messageId) {
try {
long[] storedValues = persistenceAdapter.getStoreSequenceIdForMessageId(messageId, destination);
long[] storedValues = persistenceAdapter.getStoreSequenceIdForMessageId(null, messageId, destination);
lastRecoveredSequenceId.set(storedValues[0]);
lastRecoveredPriority.set(storedValues[1]);
} catch (IOException ignoredAsAlreadyLogged) {

View File

@ -833,9 +833,9 @@ public class JDBCPersistenceAdapter extends DataSourceServiceSupport implements
}
}
long[] getStoreSequenceIdForMessageId(MessageId messageId, ActiveMQDestination destination) throws IOException {
long[] getStoreSequenceIdForMessageId(ConnectionContext context, MessageId messageId, ActiveMQDestination destination) throws IOException {
long[] result = new long[]{-1, Byte.MAX_VALUE -1};
TransactionContext c = getTransactionContext();
TransactionContext c = getTransactionContext(context);
try {
result = adapter.getStoreSequenceId(c, destination, messageId);
} catch (SQLException e) {