Fixed bug #291340: Race condition in onException() notifications.
git-svn-id: svn+ssh://dev.eclipse.org/svnroot/rt/org.eclipse.jetty/jetty/branches/jetty-7.0.0.x@967 7e9141cc-0065-0410-87d8-b60c137991c4
diff --git a/VERSION.txt b/VERSION.txt
index c229587..f409738 100644
--- a/VERSION.txt
+++ b/VERSION.txt
@@ -1,3 +1,6 @@
+jetty-7.0.0-RC7-SNAPSHOT
+291340 Race condition in onException() notifications
+
jetty-7.0.0.v20091001 October 1, 2009
jetty-7.0.0.RC6 September 21 2009
diff --git a/jetty-client/src/main/java/org/eclipse/jetty/client/HttpConnection.java b/jetty-client/src/main/java/org/eclipse/jetty/client/HttpConnection.java
index 521844d..3724587 100644
--- a/jetty-client/src/main/java/org/eclipse/jetty/client/HttpConnection.java
+++ b/jetty-client/src/main/java/org/eclipse/jetty/client/HttpConnection.java
@@ -4,11 +4,11 @@
// All rights reserved. This program and the accompanying materials
// are made available under the terms of the Eclipse Public License v1.0
// and Apache License v2.0 which accompanies this distribution.
-// The Eclipse Public License is available at
+// The Eclipse Public License is available at
// http://www.eclipse.org/legal/epl-v10.html
// The Apache License v2.0 is available at
// http://www.opensource.org/licenses/apache2.0.php
-// You may elect to redistribute this code under either of these licenses.
+// You may elect to redistribute this code under either of these licenses.
// ========================================================================
package org.eclipse.jetty.client;
@@ -36,7 +36,7 @@
import org.eclipse.jetty.util.thread.Timeout;
/**
- *
+ *
* @version $Revision: 879 $ $Date: 2009-09-11 16:13:28 +0200 (Fri, 11 Sep 2009) $
*/
public class HttpConnection implements Connection
@@ -77,12 +77,12 @@
{
_reserved = reserved;
}
-
+
public boolean isReserved()
{
return _reserved;
}
-
+
public HttpDestination getDestination()
{
return _destination;
@@ -212,7 +212,7 @@
_generator.complete();
}
}
-
+
if (_generator.isComplete() && !_requestComplete)
{
_requestComplete = true;
@@ -240,31 +240,31 @@
}
}
catch (Throwable e)
- {
+ {
Log.debug("Failure on " + _exchange, e);
if (e instanceof ThreadDeath)
throw (ThreadDeath)e;
-
+
synchronized (this)
{
if (_exchange != null)
{
- _exchange.getEventListener().onException(e);
_exchange.setStatus(HttpExchange.STATUS_EXCEPTED);
+ _exchange.getEventListener().onException(e);
}
}
failed = true;
if (e instanceof IOException)
throw (IOException)e;
-
+
if (e instanceof Error)
throw (Error)e;
-
+
if (e instanceof RuntimeException)
throw (RuntimeException)e;
-
+
throw new RuntimeException(e);
}
finally
@@ -298,7 +298,7 @@
{
if (!close)
close = shouldClose();
-
+
reset(true);
no_progress = 0;
@@ -343,7 +343,7 @@
return _exchange == null;
}
}
-
+
/**
* @see org.eclipse.jetty.io.Connection#isSuspended()
*/
diff --git a/jetty-client/src/main/java/org/eclipse/jetty/client/HttpDestination.java b/jetty-client/src/main/java/org/eclipse/jetty/client/HttpDestination.java
index eebb0aa..163dc73 100644
--- a/jetty-client/src/main/java/org/eclipse/jetty/client/HttpDestination.java
+++ b/jetty-client/src/main/java/org/eclipse/jetty/client/HttpDestination.java
@@ -253,8 +253,8 @@
else if (_queue.size() > 0)
{
HttpExchange ex = _queue.removeFirst();
- ex.getEventListener().onConnectionFailed(throwable);
ex.setStatus(HttpExchange.STATUS_EXCEPTED);
+ ex.getEventListener().onConnectionFailed(throwable);
}
}
@@ -279,8 +279,8 @@
if (_queue.size() > 0)
{
HttpExchange ex = _queue.removeFirst();
- ex.getEventListener().onException(throwable);
ex.setStatus(HttpExchange.STATUS_EXCEPTED);
+ ex.getEventListener().onException(throwable);
}
}
}