Skip to content

Commit

Permalink
reflect need for store to set messageId.setFutureOrSequenceLong for j…
Browse files Browse the repository at this point in the history
…ournaled jdbc
  • Loading branch information
gtully committed Aug 30, 2014
1 parent 8a37f97 commit e8f8155
Showing 1 changed file with 9 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
import org.apache.activemq.command.MessageAck;
import org.apache.activemq.command.MessageId;
import org.apache.activemq.filter.NonCachedMessageEvaluationContext;
import org.apache.activemq.store.IndexListener;
import org.apache.activemq.store.MessageRecoveryListener;
import org.apache.activemq.store.MessageStore;
import org.apache.activemq.store.PersistenceAdapter;
Expand Down Expand Up @@ -88,7 +89,7 @@ public void setMemoryUsage(MemoryUsage memoryUsage) {
* Not synchronized since the Journal has better throughput if you increase
* the number of concurrent writes that it is doing.
*/
public void addMessage(ConnectionContext context, final Message message) throws IOException {
public void addMessage(final ConnectionContext context, final Message message) throws IOException {

final MessageId id = message.getMessageId();

Expand All @@ -100,7 +101,7 @@ public void addMessage(ConnectionContext context, final Message message) throws
if (debug) {
LOG.debug("Journalled message add for: " + id + ", at: " + location);
}
addMessage(message, location);
addMessage(context, message, location);
} else {
if (debug) {
LOG.debug("Journalled transacted message add for: " + id + ", at: " + location);
Expand All @@ -116,7 +117,7 @@ public void afterCommit() throws Exception {
}
synchronized (JournalMessageStore.this) {
inFlightTxLocations.remove(location);
addMessage(message, location);
addMessage(context, message, location);
}
}

Expand All @@ -133,11 +134,15 @@ public void afterRollback() throws Exception {
}
}

void addMessage(final Message message, final RecordLocation location) {
void addMessage(ConnectionContext context, final Message message, final RecordLocation location) {
synchronized (this) {
lastLocation = location;
MessageId id = message.getMessageId();
messages.put(id, message);
message.getMessageId().setFutureOrSequenceLong(0l);
if (indexListener != null) {
indexListener.onAdd(new IndexListener.MessageContext(context, message, null));
}
}
}

Expand Down

0 comments on commit e8f8155

Please sign in to comment.