Fixed client abort association

git-svn-id: svn+ssh://dev.eclipse.org/svnroot/rt/org.eclipse.jetty/jetty/trunk@1020 7e9141cc-0065-0410-87d8-b60c137991c4
This commit is contained in:
Greg Wilkins 2009-10-31 11:35:06 +00:00
parent 92e596399a
commit b71d1a7b0f
4 changed files with 34 additions and 20 deletions

View File

@ -13,6 +13,7 @@ jetty-7.0.1-SNAPSHOT
+ 292825 Continuations ISE rather than ignore bad transitions
+ 292546 Proactively enforce HttpClient idle timeout
+ 293506 Unable to use jconsole with Jetty when running with security manager
+ 293557 Add "jad" mime mapping
+ JETTY-937 More JVM bug work arounds. Insert pause if all else fails
+ JETTY-983 Send content-length with multipart ranges
+ JETTY-1114 unsynchronised WebAppClassloader.getResource(String)
@ -27,7 +28,7 @@ jetty-7.0.1-SNAPSHOT
+ Promoted Jetty Centralized Logging from Sandbox
+ Promoted Jetty WebApp Verifier from Sandbox
+ Refactored continuation test harnessess
+ 293557 Add "jad" mime mapping
+ Fixed client abort asocciation
jetty-7.0.0.v20091005 5 October 2009
291340 Race condition in onException() notifications

View File

@ -318,7 +318,7 @@ public class HttpConnection implements Connection
no_progress = 0;
if (_exchange != null)
{
_exchange.disassociate(this);
_exchange.disassociate();
_exchange = null;
if (_pipeline == null)
@ -353,7 +353,7 @@ public class HttpConnection implements Connection
finally
{
if (_exchange != null && _exchange.isAssociated())
_exchange.disassociate(this);
_exchange.disassociate();
}
}
@ -581,7 +581,7 @@ public class HttpConnection implements Connection
_exchange = null;
if (ex != null)
{
ex.disassociate(HttpConnection.this);
ex.disassociate();
_destination.returnConnection(HttpConnection.this, true);
}
else if (_idle.compareAndSet(true,false))

View File

@ -93,7 +93,7 @@ public class HttpExchange
// controls if the exchange will have listeners autoconfigured by the destination
private boolean _configureListeners = true;
private HttpEventListener _listener = new Listener();
private volatile HttpConnection connection;
private volatile HttpConnection _connection;
boolean _onRequestCompleteDone;
boolean _onResponseCompleteDone;
@ -601,6 +601,7 @@ public class HttpExchange
{
synchronized(this)
{
disassociate();
_onDone=true;
notifyAll();
}
@ -608,7 +609,7 @@ public class HttpExchange
private void abort()
{
HttpConnection httpConnection = this.connection;
HttpConnection httpConnection = _connection;
if (httpConnection != null)
{
try
@ -626,20 +627,20 @@ public class HttpExchange
void associate(HttpConnection connection)
{
this.connection = connection;
_connection = connection;
if (getStatus() == STATUS_CANCELLING)
abort();
}
boolean isAssociated()
{
return this.connection != null;
return this._connection != null;
}
HttpConnection disassociate(HttpConnection connection)
HttpConnection disassociate()
{
HttpConnection result = this.connection;
this.connection = null;
HttpConnection result = _connection;
this._connection = null;
if (getStatus() == STATUS_CANCELLING)
setStatus(STATUS_CANCELLED);
return result;
@ -834,6 +835,8 @@ public class HttpExchange
{
_onRequestCompleteDone=true;
_onDone=_onResponseCompleteDone;
if (_onDone)
disassociate();
HttpExchange.this.notifyAll();
}
}
@ -851,6 +854,8 @@ public class HttpExchange
{
_onResponseCompleteDone=true;
_onDone=_onRequestCompleteDone;
if (_onDone)
disassociate();
HttpExchange.this.notifyAll();
}
}

View File

@ -289,17 +289,25 @@ public abstract class AbstractHttpExchangeCancelTest extends TestCase
public void testHttpExchangeOnServerException() throws Exception
{
TestHttpExchange exchange = new TestHttpExchange();
exchange.setAddress(newAddress());
exchange.setURI("/?action=throw");
try
{
System.err.println("doing it");
TestHttpExchange exchange = new TestHttpExchange();
exchange.setAddress(newAddress());
exchange.setURI("/?action=throw");
getHttpClient().send(exchange);
getHttpClient().send(exchange);
int status = exchange.waitForDone();
assertEquals(HttpExchange.STATUS_COMPLETED, status);
assertTrue(exchange.isResponseCompleted());
assertFalse(exchange.isFailed());
assertFalse(exchange.isAssociated());
int status = exchange.waitForDone();
assertEquals(HttpExchange.STATUS_COMPLETED, status);
assertTrue(exchange.isResponseCompleted());
assertFalse(exchange.isFailed());
assertFalse(exchange.isAssociated());
}
finally
{
System.err.println("OVER");
}
}
public void testHttpExchangeOnExpire() throws Exception