[jboss-cvs] JBoss Messaging SVN: r3268 - trunk/src/main/org/jboss/jms/server/endpoint.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Wed Oct 31 10:35:03 EDT 2007
Author: timfox
Date: 2007-10-31 10:35:03 -0400 (Wed, 31 Oct 2007)
New Revision: 3268
Modified:
trunk/src/main/org/jboss/jms/server/endpoint/ServerConsumerEndpoint.java
trunk/src/main/org/jboss/jms/server/endpoint/ServerSessionEndpoint.java
Log:
Prevent hang when reconnecting after killing client with replicating consumer
Modified: trunk/src/main/org/jboss/jms/server/endpoint/ServerConsumerEndpoint.java
===================================================================
--- trunk/src/main/org/jboss/jms/server/endpoint/ServerConsumerEndpoint.java 2007-10-31 14:09:57 UTC (rev 3267)
+++ trunk/src/main/org/jboss/jms/server/endpoint/ServerConsumerEndpoint.java 2007-10-31 14:35:03 UTC (rev 3268)
@@ -109,6 +109,8 @@
private boolean slow;
+ private volatile boolean dead;
+
// Constructors ---------------------------------------------------------------------------------
ServerConsumerEndpoint(String id, Queue messageQueue, String queueName,
@@ -458,9 +460,20 @@
void setStarted(boolean started)
{
- this.started = started;
+ //No need to lock since caller already has the lock
+ this.started = started;
}
+ void setDead()
+ {
+ dead = true;
+ }
+
+ boolean isDead()
+ {
+ return dead;
+ }
+
Queue getDLQ()
{
return dlq;
Modified: trunk/src/main/org/jboss/jms/server/endpoint/ServerSessionEndpoint.java
===================================================================
--- trunk/src/main/org/jboss/jms/server/endpoint/ServerSessionEndpoint.java 2007-10-31 14:09:57 UTC (rev 3267)
+++ trunk/src/main/org/jboss/jms/server/endpoint/ServerSessionEndpoint.java 2007-10-31 14:35:03 UTC (rev 3268)
@@ -1254,7 +1254,7 @@
}
rec.del.cancel();
- }
+ }
/*
* When a consumer closes there may be deliveries where the replication messages has gone out to the backup
@@ -1439,6 +1439,12 @@
return;
}
+
+ if (consumer.isDead())
+ {
+ //Ignore any responses that come back after consumer has died
+ return;
+ }
if (trace) { log.trace(this + " performing delivery for " + ref); }
@@ -1500,11 +1506,13 @@
//which will remove the consumer
consumer.setStarted(false);
+
+ consumer.setDead();
//** IMPORTANT NOTE! We must return the delivery NOT null. **
//This is because if we return NULL then message will remain in the queue, but later
//the connection checker will cleanup and close this consumer which will cancel all the deliveries in it
- //including this one, so the message will go back on the queue twice!
+ //including this one, so the message will go back on the queue twice!
}
}
More information about the jboss-cvs-commits
mailing list