public void run()
{
try
{
ByteArrayEndPoint endPoint = new ByteArrayEndPoint(_requestsBuffer.asArray(), 1024)
{
@Override
public void setConnection(Connection connection)
{
if (getConnection()!=null && connection!=getConnection())
connectionUpgraded(getConnection(),connection);
super.setConnection(connection);
}
};
endPoint.setGrowOutput(true);
AbstractHttpConnection connection = new BlockingHttpConnection(LocalConnector.this, endPoint, getServer());
endPoint.setConnection(connection);
connectionOpened(connection);
boolean leaveOpen = _keepOpen;
try
{
while (endPoint.getIn().length() > 0 && endPoint.isOpen())
{
while (true)
{
final Connection con = endPoint.getConnection();
final Connection next = con.handle();
if (next!=con)
{
endPoint.setConnection(next);
continue;
}
break;
}
}
}
catch (IOException x)
{
LOG.debug(x);
leaveOpen = false;
}
catch (Exception x)
{
LOG.warn(x);
leaveOpen = false;
}
finally
{
if (!leaveOpen)
connectionClosed(connection);
_responsesBuffer = endPoint.getOut();
}
}
finally
{
if (_latch != null)