removed extra HttpInput synchronization
This commit is contained in:
parent
ea8a0f0e9a
commit
5d14d0ca7a
|
@ -28,7 +28,6 @@ import javax.servlet.ServletInputStream;
|
||||||
|
|
||||||
import org.eclipse.jetty.io.EofException;
|
import org.eclipse.jetty.io.EofException;
|
||||||
import org.eclipse.jetty.io.RuntimeIOException;
|
import org.eclipse.jetty.io.RuntimeIOException;
|
||||||
import org.eclipse.jetty.server.handler.ContextHandler;
|
|
||||||
import org.eclipse.jetty.util.ArrayQueue;
|
import org.eclipse.jetty.util.ArrayQueue;
|
||||||
import org.eclipse.jetty.util.BufferUtil;
|
import org.eclipse.jetty.util.BufferUtil;
|
||||||
import org.eclipse.jetty.util.Callback;
|
import org.eclipse.jetty.util.Callback;
|
||||||
|
@ -115,7 +114,6 @@ public class HttpInput extends ServletInputStream implements Runnable
|
||||||
|
|
||||||
private void wake()
|
private void wake()
|
||||||
{
|
{
|
||||||
// TODO review if this is correct
|
|
||||||
_channelState.getHttpChannel().getConnector().getExecutor().execute(_channelState.getHttpChannel());
|
_channelState.getHttpChannel().getConnector().getExecutor().execute(_channelState.getHttpChannel());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -360,19 +358,15 @@ public class HttpInput extends ServletInputStream implements Runnable
|
||||||
boolean woken=false;
|
boolean woken=false;
|
||||||
synchronized (_inputQ)
|
synchronized (_inputQ)
|
||||||
{
|
{
|
||||||
boolean wasEmpty = _inputQ.isEmpty();
|
_inputQ.addUnsafe(item);
|
||||||
_inputQ.add(item);
|
|
||||||
if (LOG.isDebugEnabled())
|
if (LOG.isDebugEnabled())
|
||||||
LOG.debug("{} addContent {}", this, item);
|
LOG.debug("{} addContent {}", this, item);
|
||||||
|
|
||||||
if (wasEmpty) // TODO do we need this guard?
|
|
||||||
{
|
|
||||||
if (_listener==null)
|
if (_listener==null)
|
||||||
_inputQ.notify();
|
_inputQ.notify();
|
||||||
else
|
else
|
||||||
woken=_channelState.onReadPossible();
|
woken=_channelState.onReadPossible();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return woken;
|
return woken;
|
||||||
}
|
}
|
||||||
|
@ -381,7 +375,7 @@ public class HttpInput extends ServletInputStream implements Runnable
|
||||||
{
|
{
|
||||||
synchronized (_inputQ)
|
synchronized (_inputQ)
|
||||||
{
|
{
|
||||||
return !_inputQ.isEmpty();
|
return _inputQ.sizeUnsafe()>0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -580,7 +574,7 @@ public class HttpInput extends ServletInputStream implements Runnable
|
||||||
{
|
{
|
||||||
if (error!=null)
|
if (error!=null)
|
||||||
{
|
{
|
||||||
_channelState.getHttpChannel().getResponse().getHttpFields().add(HttpConnection.CONNECTION_CLOSE); // TODO ???
|
_channelState.getHttpChannel().getResponse().getHttpFields().add(HttpConnection.CONNECTION_CLOSE);
|
||||||
listener.onError(error);
|
listener.onError(error);
|
||||||
}
|
}
|
||||||
else if (aeof)
|
else if (aeof)
|
||||||
|
@ -596,7 +590,7 @@ public class HttpInput extends ServletInputStream implements Runnable
|
||||||
{
|
{
|
||||||
if (aeof || error==null)
|
if (aeof || error==null)
|
||||||
{
|
{
|
||||||
_channelState.getHttpChannel().getResponse().getHttpFields().add(HttpConnection.CONNECTION_CLOSE); // TODO ???
|
_channelState.getHttpChannel().getResponse().getHttpFields().add(HttpConnection.CONNECTION_CLOSE);
|
||||||
listener.onError(e);
|
listener.onError(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -254,6 +254,12 @@ public class ArrayQueue<E> extends AbstractList<E> implements Queue<E>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* ------------------------------------------------------------ */
|
||||||
|
public int sizeUnsafe()
|
||||||
|
{
|
||||||
|
return _size;
|
||||||
|
}
|
||||||
|
|
||||||
/* ------------------------------------------------------------ */
|
/* ------------------------------------------------------------ */
|
||||||
@Override
|
@Override
|
||||||
public E get(int index)
|
public E get(int index)
|
||||||
|
|
Loading…
Reference in New Issue