Fix for #300178 - HttpClients opens too many connections that are immediately closed.
git-svn-id: svn+ssh://dev.eclipse.org/svnroot/rt/org.eclipse.jetty/jetty/trunk@1207 7e9141cc-0065-0410-87d8-b60c137991c4
This commit is contained in:
parent
d9204dcd46
commit
23568f58af
|
@ -16,6 +16,7 @@ jetty-7.0.2-SNAPSHOT
|
|||
+ JETTY-1157 Don't hold array passed in write(byte[])
|
||||
+ JETTY-1151 JETTY-1098 allow UTF-8 with 0 carry bits
|
||||
+ COMETD-46 reset ContentExchange response content on resend
|
||||
+ 300178 HttpClients opens too many connections that are immediately closed
|
||||
|
||||
jetty-7.0.1.v20091125 25 November 2009
|
||||
+ 274251 DefaultServlet supports exact match mode.
|
||||
|
|
|
@ -79,7 +79,7 @@ public class HttpConnection implements Connection
|
|||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
public void setReserved (boolean reserved)
|
||||
{
|
||||
_reserved = reserved;
|
||||
|
@ -565,7 +565,7 @@ public class HttpConnection implements Connection
|
|||
}
|
||||
}
|
||||
|
||||
public void setIdleTimeout(long expire)
|
||||
public void setIdleTimeout()
|
||||
{
|
||||
synchronized (this)
|
||||
{
|
||||
|
@ -575,7 +575,7 @@ public class HttpConnection implements Connection
|
|||
throw new IllegalStateException();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public boolean cancelIdleTimeout()
|
||||
{
|
||||
synchronized (this)
|
||||
|
@ -586,10 +586,10 @@ public class HttpConnection implements Connection
|
|||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
private class TimeoutTask extends Timeout.Task
|
||||
{
|
||||
@Override
|
||||
|
|
|
@ -107,7 +107,7 @@ public class HttpDestination
|
|||
return _connections.size();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public int getIdleConnections()
|
||||
{
|
||||
synchronized (this)
|
||||
|
@ -115,7 +115,7 @@ public class HttpDestination
|
|||
return _idle.size();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void addAuthorization(String pathSpec, Authorization authorization)
|
||||
{
|
||||
synchronized (this)
|
||||
|
@ -154,11 +154,10 @@ public class HttpDestination
|
|||
|
||||
while ((connection == null) && (connection = getIdleConnection()) == null && timeout>0)
|
||||
{
|
||||
int totalConnections = 0;
|
||||
boolean starting = false;
|
||||
synchronized (this)
|
||||
{
|
||||
totalConnections = _connections.size() + _pendingConnections;
|
||||
int totalConnections = _connections.size() + _pendingConnections;
|
||||
if (totalConnections < _maxConnections)
|
||||
{
|
||||
_newConnection++;
|
||||
|
@ -211,8 +210,6 @@ public class HttpDestination
|
|||
|
||||
public HttpConnection getIdleConnection() throws IOException
|
||||
{
|
||||
long now = _client.getNow();
|
||||
long idleTimeout=_client.getIdleTimeout();
|
||||
HttpConnection connection = null;
|
||||
while (true)
|
||||
{
|
||||
|
@ -317,6 +314,7 @@ public class HttpDestination
|
|||
}
|
||||
else if (_queue.size() == 0)
|
||||
{
|
||||
connection.setIdleTimeout();
|
||||
_idle.add(connection);
|
||||
}
|
||||
else
|
||||
|
@ -365,7 +363,7 @@ public class HttpDestination
|
|||
{
|
||||
if (_queue.size() == 0)
|
||||
{
|
||||
connection.setIdleTimeout(_client.getNow()+_client.getIdleTimeout());
|
||||
connection.setIdleTimeout();
|
||||
_idle.add(connection);
|
||||
}
|
||||
else
|
||||
|
@ -405,7 +403,7 @@ public class HttpDestination
|
|||
if (!_queue.isEmpty() && _client.isStarted())
|
||||
startNewConnection();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
public void send(HttpExchange ex) throws IOException
|
||||
|
|
Loading…
Reference in New Issue