Reduce the amount of work done while the sendLock is acquired.

git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@1482805 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Hiram R. Chirino 2013-05-15 13:11:07 +00:00
parent 548c19496c
commit c5788d24bc
1 changed files with 4 additions and 3 deletions

View File

@ -799,12 +799,13 @@ public class Queue extends BaseDestination implements Task, UsageListener {
if (!orderedWork.isEmpty()) {
ArrayList<SendSync> syncs = new ArrayList<SendSync>(orderedWork.size());;
for (Transaction tx : orderedWork) {
syncs.add(sendSyncs.remove(tx));
}
sendLock.lockInterruptibly();
try {
for (Transaction tx : orderedWork) {
SendSync sync = sendSyncs.remove(tx);
for (SendSync sync : syncs) {
sync.processSend();
syncs.add(sync);
}
} finally {
sendLock.unlock();