add synchronize around pending

- see http://www.nabble.com/Is-anyone-else-seeing-messages-stuck-on-a-queue--tf3027911.html#a8550623


git-svn-id: https://svn.apache.org/repos/asf/incubator/activemq/trunk@499173 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Robert Davies 2007-01-23 22:50:15 +00:00
parent 21391ceab4
commit 30716b1519
1 changed files with 2 additions and 2 deletions

View File

@ -104,7 +104,7 @@ abstract public class PrefetchSubscription extends AbstractSubscription{
* Occurs when a pull times out. If nothing has been dispatched since the timeout was setup, then send the NULL
* message.
*/
private void pullTimeout(long dispatchCounterBeforePull){
private synchronized void pullTimeout(long dispatchCounterBeforePull){
if(dispatchCounterBeforePull==dispatchCounter){
try{
add(QueueMessageReference.NULL_MESSAGE);
@ -368,7 +368,7 @@ abstract public class PrefetchSubscription extends AbstractSubscription{
pending.remove(context,destination);
}
protected void dispatchMatched() throws IOException{
protected synchronized void dispatchMatched() throws IOException{
if(!broker.isSlaveBroker()&&dispatching.compareAndSet(false,true)){
try{
try{