333892 Improved JVM bug detection

git-svn-id: svn+ssh://dev.eclipse.org/svnroot/rt/org.eclipse.jetty/jetty/trunk@2648 7e9141cc-0065-0410-87d8-b60c137991c4
This commit is contained in:
Greg Wilkins 2011-01-10 20:59:30 +00:00
parent 0109d0cbe6
commit 9e75b312bb
4 changed files with 47 additions and 13 deletions

View File

@ -17,6 +17,7 @@ jetty-7.3.0-SNAPSHOT
+ 333679 Refactored jetty-jmx. Moved mbeans to modules
+ 333771 System properties are not available inside XML configuration file by using the 'property' tag
+ 333875 Monitor public constructor
+ 333892 Improved JVM bug detection
jetty-7.2.2.v20101205 5 December 2010
+ JETTY-1308 327109 (re)fixed AJP handling of empty packets

View File

@ -168,10 +168,19 @@ public class SelectChannelEndPoint extends ChannelEndPoint implements AsyncEndPo
_writable = true; // Once writable is in ops, only removed with dispatch.
}
if (_dispatched)
_key.interestOps(0);
if (_selectSet.getManager().isDeferringInterestedOps0())
{
if (_dispatched)
_key.interestOps(0);
else
dispatch();
}
else
dispatch();
{
_key.interestOps(0);
if (!_dispatched)
dispatch();
}
}
}

View File

@ -59,6 +59,7 @@ public abstract class SelectorManager extends AbstractLifeCycle
private SelectSet[] _selectSet;
private int _selectSets=1;
private volatile int _set;
private boolean _deferringInterestedOps0;
/* ------------------------------------------------------------ */
/**
@ -450,7 +451,7 @@ public abstract class SelectorManager extends AbstractLifeCycle
long now=System.currentTimeMillis();
// if no immediate things to do
if (selected==0)
if (selected==0 && selector.selectedKeys().isEmpty())
{
// If we are in pausing mode
if (_pausing)
@ -871,5 +872,17 @@ public abstract class SelectorManager extends AbstractLifeCycle
_attachment = attachment;
}
}
/* ------------------------------------------------------------ */
public boolean isDeferringInterestedOps0()
{
return _deferringInterestedOps0;
}
/* ------------------------------------------------------------ */
public void setDeferringInterestedOps0(boolean defferringInterestedOps0)
{
_deferringInterestedOps0 = defferringInterestedOps0;
}
}

View File

@ -81,14 +81,14 @@ public class StressTest
_stress= Boolean.getBoolean("STRESS");
_threads = new QueuedThreadPool(new BlockingArrayQueue<Runnable>(4,4));
_threads.setMaxThreads(500);
_threads.setMaxThreads(200);
_server = new Server();
_server.setThreadPool(_threads);
_connector = new SelectChannelConnector();
_connector.setAcceptors(1);
_connector.setAcceptQueueSize(1000);
_connector.setAcceptors(Runtime.getRuntime().availableProcessors()/2);
_connector.setAcceptQueueSize(5000);
_connector.setMaxIdleTime(30000);
_server.addConnector(_connector);
@ -116,25 +116,29 @@ public class StressTest
@Test
public void testNonPersistent() throws Throwable
{
doThreads(10,100,false);
if (_stress)
{
System.err.println("STRESS!");
doThreads(200,100,false);
Thread.sleep(1000);
doThreads(200,10,false);
Thread.sleep(1000);
doThreads(200,200,false);
}
else
doThreads(10,20,false);
}
@Test
public void testPersistent() throws Throwable
{
doThreads(20,100,true);
if (_stress)
{
System.err.println("STRESS!");
doThreads(200,100,true);
Thread.sleep(1000);
doThreads(200,10,true);
Thread.sleep(1000);
doThreads(200,200,true);
}
else
doThreads(20,40,true);
}
private void doThreads(int threadCount, final int loops, final boolean persistent) throws Throwable
@ -241,6 +245,8 @@ public class StressTest
final int length[] = new int[_latencies.length];
final int other[] = new int[_latencies.length];
long total=0;
for (int i=0;i<_latencies.length;i++)
{
Queue<Long> latencies=_latencies[i];
@ -249,6 +255,8 @@ public class StressTest
loop:
for (long latency : latencies)
{
if (i==4)
total+=latency;
for (int q=0;q<quantums;q++)
{
if (latency>=(q*100) && latency<((q+1)*100))
@ -258,6 +266,7 @@ public class StressTest
}
}
other[i]++;
}
}
@ -283,6 +292,8 @@ public class StressTest
for (int i=0;i<_latencies.length;i++)
System.out.print("\t"+length[i]);
System.out.println();
long ave=total/_latencies[4].size();
System.out.println("ave="+ave);
}
}