JETTY-1247 synchronize recylcing of SSL NIO buffers

git-svn-id: svn+ssh://dev.eclipse.org/svnroot/rt/org.eclipse.jetty/jetty/trunk@2109 7e9141cc-0065-0410-87d8-b60c137991c4
This commit is contained in:
Greg Wilkins 2010-07-13 01:44:19 +00:00
parent 46c4b7daa7
commit 9612eb956a
3 changed files with 40 additions and 15 deletions

View File

@ -2,6 +2,7 @@ jetty-7.2-SNAPSHOT
+ 319334 Concurrent, sharable ResourceCache
+ 319370 WebAppClassLoader.Context
+ 319519 Warn about duplicate configuration files
+ JETTY-1247 synchronize recylcing of SSL NIO buffers
+ JETTY-1249 Apply max idle time
+ Added ignore to Logger interface

View File

@ -458,7 +458,7 @@ public abstract class SelectorManager extends AbstractLifeCycle
retry_next=_timeout.getTimeToNext();
// workout how low to wait in select
long wait = 1000L;
long wait = _changes.size()==0?200L:0L;
if (wait > 0 && retry_next >= 0 && wait > retry_next)
wait = retry_next;

View File

@ -82,7 +82,11 @@ public class SslSelectChannelEndPoint extends SelectChannelEndPoint
{
if (_outNIOBuffer==null)
{
_outNIOBuffer=(NIOBuffer)_buffers.getBuffer(_session.getPacketBufferSize());
synchronized (this)
{
if (_outNIOBuffer==null)
_outNIOBuffer=(NIOBuffer)_buffers.getBuffer(_session.getPacketBufferSize());
}
}
}
@ -91,27 +95,43 @@ public class SslSelectChannelEndPoint extends SelectChannelEndPoint
{
if (_inNIOBuffer==null)
{
_inNIOBuffer=(NIOBuffer)_buffers.getBuffer(_session.getPacketBufferSize());
synchronized (this)
{
if(_inNIOBuffer==null)
_inNIOBuffer=(NIOBuffer)_buffers.getBuffer(_session.getPacketBufferSize());
}
}
}
/* ------------------------------------------------------------ */
private void freeOutBuffer()
{
if (_outNIOBuffer.length()==0)
if (_outNIOBuffer!=null)
{
_buffers.returnBuffer(_outNIOBuffer);
_outNIOBuffer=null;
synchronized (this)
{
if (_outNIOBuffer!=null && _outNIOBuffer.length()==0)
{
_buffers.returnBuffer(_outNIOBuffer);
_outNIOBuffer=null;
}
}
}
}
/* ------------------------------------------------------------ */
private void freeInBuffer()
{
if (_inNIOBuffer.length()==0)
if (_inNIOBuffer!=null)
{
_buffers.returnBuffer(_inNIOBuffer);
_inNIOBuffer=null;
synchronized (this)
{
if (_inNIOBuffer!=null && _inNIOBuffer.length()==0)
{
_buffers.returnBuffer(_inNIOBuffer);
_inNIOBuffer=null;
}
}
}
}
@ -261,10 +281,15 @@ public class SslSelectChannelEndPoint extends SelectChannelEndPoint
finally
{
super.close();
if (_inNIOBuffer!=null)
_buffers.returnBuffer(_inNIOBuffer);
if (_outNIOBuffer!=null)
_buffers.returnBuffer(_outNIOBuffer);
synchronized (this)
{
if (_inNIOBuffer!=null)
_buffers.returnBuffer(_inNIOBuffer);
_inNIOBuffer=null;
if (_outNIOBuffer!=null)
_buffers.returnBuffer(_outNIOBuffer);
_outNIOBuffer=null;
}
}
}
@ -664,8 +689,7 @@ public class SslSelectChannelEndPoint extends SelectChannelEndPoint
{
if(!isOpen())
{
if (_outNIOBuffer!=null)
_outNIOBuffer.clear();
freeOutBuffer();
throw new EofException();
}
return false;