removed reset synchs
git-svn-id: svn+ssh://dev.eclipse.org/svnroot/rt/org.eclipse.jetty/jetty/trunk@393 7e9141cc-0065-0410-87d8-b60c137991c4
This commit is contained in:
parent
d7c3fdfc60
commit
3cf3616308
|
@ -111,29 +111,22 @@ public abstract class AbstractGenerator implements Generator
|
|||
_contentWritten = 0;
|
||||
_contentLength = HttpTokens.UNKNOWN_CONTENT;
|
||||
|
||||
synchronized(this)
|
||||
// always return the buffer
|
||||
Buffer buffer=_buffer;
|
||||
_buffer=null;
|
||||
if (buffer!=null && _header!=buffer)
|
||||
_buffers.returnBuffer(buffer);
|
||||
|
||||
if (returnBuffers)
|
||||
{
|
||||
if (returnBuffers)
|
||||
{
|
||||
if (_header != null)
|
||||
_buffers.returnBuffer(_header);
|
||||
_header = null;
|
||||
if (_buffer != null)
|
||||
_buffers.returnBuffer(_buffer);
|
||||
_buffer = null;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (_header != null)
|
||||
_header.clear();
|
||||
|
||||
if (_buffer != null)
|
||||
{
|
||||
_buffers.returnBuffer(_buffer);
|
||||
_buffer = null;
|
||||
}
|
||||
}
|
||||
buffer=_header;
|
||||
_header=null;
|
||||
if (buffer!=null)
|
||||
_buffers.returnBuffer(buffer);
|
||||
}
|
||||
else if (_header != null)
|
||||
_header.clear();
|
||||
|
||||
_content = null;
|
||||
_method=null;
|
||||
}
|
||||
|
|
|
@ -919,68 +919,65 @@ public class HttpParser implements Parser
|
|||
/* ------------------------------------------------------------------------------- */
|
||||
public void reset(boolean returnBuffers)
|
||||
{
|
||||
synchronized (this)
|
||||
_contentView.setGetIndex(_contentView.putIndex());
|
||||
|
||||
_state=STATE_START;
|
||||
_contentLength=HttpTokens.UNKNOWN_CONTENT;
|
||||
_contentPosition=0;
|
||||
_length=0;
|
||||
_responseStatus=0;
|
||||
|
||||
if (_buffer!=null && _buffer.length()>0 && _eol == HttpTokens.CARRIAGE_RETURN && _buffer.peek() == HttpTokens.LINE_FEED)
|
||||
{
|
||||
_contentView.setGetIndex(_contentView.putIndex());
|
||||
|
||||
_state=STATE_START;
|
||||
_contentLength=HttpTokens.UNKNOWN_CONTENT;
|
||||
_contentPosition=0;
|
||||
_length=0;
|
||||
_responseStatus=0;
|
||||
_buffer.skip(1);
|
||||
_eol=HttpTokens.LINE_FEED;
|
||||
}
|
||||
|
||||
if (_buffer!=null && _buffer.length()>0 && _eol == HttpTokens.CARRIAGE_RETURN && _buffer.peek() == HttpTokens.LINE_FEED)
|
||||
{
|
||||
_buffer.skip(1);
|
||||
_eol=HttpTokens.LINE_FEED;
|
||||
}
|
||||
|
||||
if (_body!=null)
|
||||
{
|
||||
if (_body.hasContent())
|
||||
{
|
||||
_header.setMarkIndex(-1);
|
||||
_header.compact();
|
||||
// TODO if pipelined requests received after big input - maybe this is not good?.
|
||||
_body.skip(_header.put(_body));
|
||||
|
||||
}
|
||||
|
||||
if (_body.length()==0)
|
||||
{
|
||||
if (_buffers!=null && returnBuffers)
|
||||
_buffers.returnBuffer(_body);
|
||||
_body=null;
|
||||
}
|
||||
else
|
||||
{
|
||||
_body.setMarkIndex(-1);
|
||||
_body.compact();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (_header!=null)
|
||||
if (_body!=null)
|
||||
{
|
||||
if (_body.hasContent())
|
||||
{
|
||||
_header.setMarkIndex(-1);
|
||||
if (!_header.hasContent() && _buffers!=null && returnBuffers)
|
||||
{
|
||||
_buffers.returnBuffer(_header);
|
||||
_header=null;
|
||||
_buffer=null;
|
||||
}
|
||||
else
|
||||
{
|
||||
_header.compact();
|
||||
_tok0.update(_header);
|
||||
_tok0.update(0,0);
|
||||
_tok1.update(_header);
|
||||
_tok1.update(0,0);
|
||||
}
|
||||
_header.compact();
|
||||
// TODO if pipelined requests received after big input - maybe this is not good?.
|
||||
_body.skip(_header.put(_body));
|
||||
|
||||
}
|
||||
|
||||
_buffer=_header;
|
||||
if (_body.length()==0)
|
||||
{
|
||||
if (_buffers!=null && returnBuffers)
|
||||
_buffers.returnBuffer(_body);
|
||||
_body=null;
|
||||
}
|
||||
else
|
||||
{
|
||||
_body.setMarkIndex(-1);
|
||||
_body.compact();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (_header!=null)
|
||||
{
|
||||
_header.setMarkIndex(-1);
|
||||
if (!_header.hasContent() && _buffers!=null && returnBuffers)
|
||||
{
|
||||
_buffers.returnBuffer(_header);
|
||||
_header=null;
|
||||
_buffer=null;
|
||||
}
|
||||
else
|
||||
{
|
||||
_header.compact();
|
||||
_tok0.update(_header);
|
||||
_tok0.update(0,0);
|
||||
_tok1.update(_header);
|
||||
_tok1.update(0,0);
|
||||
}
|
||||
}
|
||||
|
||||
_buffer=_header;
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------------------- */
|
||||
|
|
|
@ -356,16 +356,11 @@ public class StressTest extends TestCase
|
|||
|
||||
System.out.print("HANDLED ");
|
||||
for (int i=0;i<_latencies.length;i++)
|
||||
{
|
||||
System.out.print("\t"+_handled.get());
|
||||
}
|
||||
System.out.println();
|
||||
System.out.print("TOTAL ");
|
||||
for (int i=0;i<_latencies.length;i++)
|
||||
{
|
||||
System.out.print("\t"+length[i]);
|
||||
assertEquals(_handled.get(),length[i]);
|
||||
}
|
||||
System.out.println();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue