mirror of https://github.com/apache/activemq.git
https://issues.apache.org/jira/browse/AMQ-6164 - allow journal write batching on a single destination
This commit is contained in:
parent
90726a60af
commit
499e39e52c
|
@ -829,8 +829,6 @@ public class Queue extends BaseDestination implements Task, UsageListener, Index
|
||||||
producerExchange.incrementSend();
|
producerExchange.incrementSend();
|
||||||
do {
|
do {
|
||||||
checkUsage(context, producerExchange, message);
|
checkUsage(context, producerExchange, message);
|
||||||
sendLock.lockInterruptibly();
|
|
||||||
try {
|
|
||||||
message.getMessageId().setBrokerSequenceId(getDestinationSequenceId());
|
message.getMessageId().setBrokerSequenceId(getDestinationSequenceId());
|
||||||
if (store != null && message.isPersistent()) {
|
if (store != null && message.isPersistent()) {
|
||||||
message.getMessageId().setFutureOrSequenceLong(null);
|
message.getMessageId().setFutureOrSequenceLong(null);
|
||||||
|
@ -854,9 +852,6 @@ public class Queue extends BaseDestination implements Task, UsageListener, Index
|
||||||
if(tryOrderedCursorAdd(message, context)) {
|
if(tryOrderedCursorAdd(message, context)) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} finally {
|
|
||||||
sendLock.unlock();
|
|
||||||
}
|
|
||||||
} while (started.get());
|
} while (started.get());
|
||||||
|
|
||||||
if (store == null || (!context.isInTransaction() && !message.isPersistent())) {
|
if (store == null || (!context.isInTransaction() && !message.isPersistent())) {
|
||||||
|
|
|
@ -59,13 +59,13 @@ public class MemoryMessageStore extends AbstractMessageStore {
|
||||||
synchronized (messageTable) {
|
synchronized (messageTable) {
|
||||||
messageTable.put(message.getMessageId(), message);
|
messageTable.put(message.getMessageId(), message);
|
||||||
incMessageStoreStatistics(getMessageStoreStatistics(), message);
|
incMessageStoreStatistics(getMessageStoreStatistics(), message);
|
||||||
}
|
|
||||||
message.incrementReferenceCount();
|
message.incrementReferenceCount();
|
||||||
message.getMessageId().setFutureOrSequenceLong(sequenceId++);
|
message.getMessageId().setFutureOrSequenceLong(sequenceId++);
|
||||||
if (indexListener != null) {
|
if (indexListener != null) {
|
||||||
indexListener.onAdd(new IndexListener.MessageContext(context, message, null));
|
indexListener.onAdd(new IndexListener.MessageContext(context, message, null));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// public void addMessageReference(ConnectionContext context,MessageId
|
// public void addMessageReference(ConnectionContext context,MessageId
|
||||||
// messageId,long expirationTime,String messageRef)
|
// messageId,long expirationTime,String messageRef)
|
||||||
|
|
|
@ -326,10 +326,9 @@ public class KahaDBStore extends MessageDatabase implements PersistenceAdapter {
|
||||||
return task;
|
return task;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// with asyncTaskMap locked
|
||||||
protected void addQueueTask(KahaDBMessageStore store, StoreQueueTask task) throws IOException {
|
protected void addQueueTask(KahaDBMessageStore store, StoreQueueTask task) throws IOException {
|
||||||
synchronized (store.asyncTaskMap) {
|
|
||||||
store.asyncTaskMap.put(new AsyncJobKey(task.getMessage().getMessageId(), store.getDestination()), task);
|
store.asyncTaskMap.put(new AsyncJobKey(task.getMessage().getMessageId(), store.getDestination()), task);
|
||||||
}
|
|
||||||
this.queueExecutor.execute(task);
|
this.queueExecutor.execute(task);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -390,10 +389,12 @@ public class KahaDBStore extends MessageDatabase implements PersistenceAdapter {
|
||||||
message.getMessageId().setFutureOrSequenceLong(future);
|
message.getMessageId().setFutureOrSequenceLong(future);
|
||||||
message.setRecievedByDFBridge(true); // flag message as concurrentStoreAndDispatch
|
message.setRecievedByDFBridge(true); // flag message as concurrentStoreAndDispatch
|
||||||
result.aquireLocks();
|
result.aquireLocks();
|
||||||
|
synchronized (asyncTaskMap) {
|
||||||
addQueueTask(this, result);
|
addQueueTask(this, result);
|
||||||
if (indexListener != null) {
|
if (indexListener != null) {
|
||||||
indexListener.onAdd(new IndexListener.MessageContext(context, message, null));
|
indexListener.onAdd(new IndexListener.MessageContext(context, message, null));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return future;
|
return future;
|
||||||
} else {
|
} else {
|
||||||
return super.asyncAddQueueMessage(context, message);
|
return super.asyncAddQueueMessage(context, message);
|
||||||
|
|
|
@ -758,7 +758,7 @@ class LevelDBStore extends LockableServiceSupport with BrokerServiceAware with P
|
||||||
uow.addCompleteListener({
|
uow.addCompleteListener({
|
||||||
message.decrementReferenceCount()
|
message.decrementReferenceCount()
|
||||||
})
|
})
|
||||||
val sequence = lastSeq.synchronized {
|
lastSeq.synchronized {
|
||||||
val seq = lastSeq.incrementAndGet()
|
val seq = lastSeq.incrementAndGet()
|
||||||
message.getMessageId.setFutureOrSequenceLong(seq);
|
message.getMessageId.setFutureOrSequenceLong(seq);
|
||||||
// null context on xa recovery, we want to bypass the cursor & pending adds as it will be reset
|
// null context on xa recovery, we want to bypass the cursor & pending adds as it will be reset
|
||||||
|
@ -768,9 +768,8 @@ class LevelDBStore extends LockableServiceSupport with BrokerServiceAware with P
|
||||||
def run(): Unit = pendingCursorAdds.synchronized { pendingCursorAdds.remove(seq) }
|
def run(): Unit = pendingCursorAdds.synchronized { pendingCursorAdds.remove(seq) }
|
||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
seq
|
uow.enqueue(key, seq, message, delay)
|
||||||
}
|
}
|
||||||
uow.enqueue(key, sequence, message, delay)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override def asyncAddQueueMessage(context: ConnectionContext, message: Message) = asyncAddQueueMessage(context, message, false)
|
override def asyncAddQueueMessage(context: ConnectionContext, message: Message) = asyncAddQueueMessage(context, message, false)
|
||||||
|
|
Loading…
Reference in New Issue