JETTY-1156 SSL blocking close with JVM Bug busy key fix

git-svn-id: svn+ssh://dev.eclipse.org/svnroot/rt/org.eclipse.jetty/jetty/trunk@1146 7e9141cc-0065-0410-87d8-b60c137991c4
This commit is contained in:
Greg Wilkins 2009-12-11 04:51:39 +00:00
parent 219c9dd740
commit 845443322b
3 changed files with 22 additions and 5 deletions

View File

@ -3,6 +3,7 @@ jetty-7.0.2-SNAPSHOT
+ 290765 Reset input for HttpExchange retry.
+ 296765 JMX Connector Server and ShutdownThread
+ 297421 Hide server/system classes from WebAppClassLoader.getResources
+ JETTY-1156 SSL blocking close with JVM Bug busy key fix
jetty-7.0.1.v20091125 25 November 2009
+ 274251 DefaultServlet supports exact match mode.

View File

@ -157,12 +157,13 @@ public class SslSelectChannelEndPoint extends SelectChannelEndPoint
// TODO - this really should not be done in a loop here - but with async callbacks.
_closing=true;
long end=System.currentTimeMillis()+((SocketChannel)_channel).socket().getSoTimeout();
try
{
if (isBufferingOutput())
{
flush();
while (isOpen() && isBufferingOutput())
while (isOpen() && isBufferingOutput() && System.currentTimeMillis()<end)
{
Thread.sleep(100); // TODO non blocking
flush();
@ -171,12 +172,12 @@ public class SslSelectChannelEndPoint extends SelectChannelEndPoint
_engine.closeOutbound();
loop: while (isOpen() && !(_engine.isInboundDone() && _engine.isOutboundDone()))
loop: while (isOpen() && !(_engine.isInboundDone() && _engine.isOutboundDone()) && System.currentTimeMillis()<end)
{
if (isBufferingOutput())
{
flush();
while (isOpen() && isBufferingOutput())
while (isOpen() && isBufferingOutput() && System.currentTimeMillis()<end)
{
Thread.sleep(100); // TODO non blocking
flush();

View File

@ -605,11 +605,26 @@ public abstract class SelectorManager extends AbstractLifeCycle
{
if (++_busyKeyCount>__BUSY_KEY && !(busy.channel() instanceof ServerSocketChannel))
{
SelectChannelEndPoint endpoint = (SelectChannelEndPoint)busy.attachment();
final SelectChannelEndPoint endpoint = (SelectChannelEndPoint)busy.attachment();
Log.warn("Busy Key "+busy.channel()+" "+endpoint);
busy.cancel();
if (endpoint!=null)
endpoint.close();
{
dispatch(new Runnable()
{
public void run()
{
try
{
endpoint.close();
}
catch (IOException e)
{
Log.ignore(e);
}
}
});
}
}
}
else