JETTY-1015 Reduce BayeuxClient and HttpClient lock contention
git-svn-id: svn+ssh://dev.eclipse.org/svnroot/rt/org.eclipse.jetty/jetty/trunk@206 7e9141cc-0065-0410-87d8-b60c137991c4
This commit is contained in:
parent
806219ab59
commit
3ee44fd757
|
@ -8,6 +8,7 @@ jetty-7.0.0.M2-SNAPSHOT
|
||||||
+ JETTY-1003 java.lang.IllegalArgumentException: timeout can't be negative
|
+ JETTY-1003 java.lang.IllegalArgumentException: timeout can't be negative
|
||||||
+ JETTY-1004 CERT VU#402580 Canonical path handling includes ? in path segment
|
+ JETTY-1004 CERT VU#402580 Canonical path handling includes ? in path segment
|
||||||
+ JETTY-1014 Enable start-stop-daemon by default on jetty.sh (START_STOP_DAEMON=1)
|
+ JETTY-1014 Enable start-stop-daemon by default on jetty.sh (START_STOP_DAEMON=1)
|
||||||
|
+ JETTY-1015 Reduce BayeuxClient and HttpClient lock contention
|
||||||
|
|
||||||
jetty-6.1.17 30 April 2009
|
jetty-6.1.17 30 April 2009
|
||||||
+ JETTY-936 Make optional dispatching to welcome files as servlets
|
+ JETTY-936 Make optional dispatching to welcome files as servlets
|
||||||
|
|
|
@ -204,26 +204,27 @@ public class HttpDestination
|
||||||
/* ------------------------------------------------------------------------------- */
|
/* ------------------------------------------------------------------------------- */
|
||||||
public HttpConnection getIdleConnection() throws IOException
|
public HttpConnection getIdleConnection() throws IOException
|
||||||
{
|
{
|
||||||
synchronized (this)
|
long now = System.currentTimeMillis();
|
||||||
|
long idleTimeout=_client.getIdleTimeout();
|
||||||
|
HttpConnection connection = null;
|
||||||
|
while (true)
|
||||||
{
|
{
|
||||||
long now = System.currentTimeMillis();
|
synchronized (this)
|
||||||
long idleTimeout = _client.getIdleTimeout();
|
|
||||||
|
|
||||||
// Find an idle connection
|
|
||||||
while (_idle.size() > 0)
|
|
||||||
{
|
{
|
||||||
HttpConnection connection = _idle.remove(_idle.size() - 1);
|
if (_idle.size() > 0)
|
||||||
long last = connection.getLast();
|
connection = _idle.remove(_idle.size()-1);
|
||||||
if (connection.getEndPoint().isOpen() && (last == 0 || ((now - last) < idleTimeout)))
|
|
||||||
return connection;
|
|
||||||
else
|
|
||||||
{
|
|
||||||
_connections.remove(connection);
|
|
||||||
connection.getEndPoint().close();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (connection==null)
|
||||||
|
return null;
|
||||||
|
|
||||||
return null;
|
long last = connection.getLast();
|
||||||
|
if (connection.getEndPoint().isOpen() && (last==0 || ((now-last)<idleTimeout)) )
|
||||||
|
return connection;
|
||||||
|
|
||||||
|
_connections.remove(connection);
|
||||||
|
connection.getEndPoint().close();
|
||||||
|
connection=null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -74,16 +74,23 @@ public class HttpExchangeTest extends TestCase
|
||||||
|
|
||||||
public void testPerf() throws Exception
|
public void testPerf() throws Exception
|
||||||
{
|
{
|
||||||
sender(1,false);
|
|
||||||
sender(1,true);
|
|
||||||
sender(10,false);
|
|
||||||
sender(10,true);
|
|
||||||
sender(100,false);
|
|
||||||
sender(100,true);
|
|
||||||
if (_stress)
|
if (_stress)
|
||||||
{
|
{
|
||||||
sender(1000,false);
|
sender(1,false);
|
||||||
sender(1000,true);
|
sender(1,true);
|
||||||
|
sender(100,false);
|
||||||
|
sender(100,true);
|
||||||
|
sender(10000,false);
|
||||||
|
sender(10000,true);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
sender(1,false);
|
||||||
|
sender(1,true);
|
||||||
|
sender(10,false);
|
||||||
|
sender(10,true);
|
||||||
|
sender(20,false);
|
||||||
|
sender(20,true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue