mirror of https://github.com/apache/activemq.git
added yield back into dispatch() - but with a counter - so not so much of a performance hog
git-svn-id: https://svn.apache.org/repos/asf/incubator/activemq/trunk@478238 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
e34cbc1b07
commit
e78a6f7ee9
|
@ -106,6 +106,7 @@ public class ActiveMQMessageConsumer implements MessageAvailableConsumer, StatsC
|
||||||
private int rollbackCounter = 0;
|
private int rollbackCounter = 0;
|
||||||
private long redeliveryDelay = 0;
|
private long redeliveryDelay = 0;
|
||||||
private int ackCounter = 0;
|
private int ackCounter = 0;
|
||||||
|
private int dispatchedCount = 0;
|
||||||
private MessageListener messageListener;
|
private MessageListener messageListener;
|
||||||
private JMSConsumerStatsImpl stats;
|
private JMSConsumerStatsImpl stats;
|
||||||
|
|
||||||
|
@ -877,6 +878,10 @@ public class ActiveMQMessageConsumer implements MessageAvailableConsumer, StatsC
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (++dispatchedCount%1000==0) {
|
||||||
|
dispatchedCount=0;
|
||||||
|
Thread.yield();
|
||||||
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
session.connection.onAsyncException(e);
|
session.connection.onAsyncException(e);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue