cleanups after the merge

This commit is contained in:
Greg Wilkins 2011-11-08 12:47:28 +11:00
parent 7a082280f1
commit 5f2323418b
8 changed files with 27 additions and 17 deletions

View File

@ -13,8 +13,6 @@
package org.eclipse.jetty.embedded;
import static org.junit.Assert.assertTrue;
import java.io.IOException;
import java.lang.management.ManagementFactory;
import java.util.concurrent.CountDownLatch;

View File

@ -96,6 +96,7 @@ public abstract class AbstractHttpConnection extends AbstractConnection implemen
public boolean send(HttpExchange ex) throws IOException
{
LOG.debug("Send {} on {}",ex,this);
synchronized (this)
{
if (_exchange != null)
@ -346,6 +347,7 @@ public abstract class AbstractHttpConnection extends AbstractConnection implemen
if (exchange!=null)
{
exchange.setStatus(HttpExchange.STATUS_EXCEPTED);
exchange.getEventListener().onException(new EofException("early EOF"));
}
}

View File

@ -48,19 +48,19 @@ public class AsyncHttpConnection extends AbstractHttpConnection implements Async
// While we are making progress and have not changed connection
while (progress && connection==this)
{
LOG.debug("open={} more={} buffering={} progress={}",_endp.isOpen(),_parser.isMoreInBuffer(),_endp.isBufferingInput(),progress);
LOG.debug("while open={} more={} buffering={} progress={}",_endp.isOpen(),_parser.isMoreInBuffer(),_endp.isBufferingInput(),progress);
progress=false;
HttpExchange exchange=_exchange;
LOG.debug("exchange {}",exchange);
LOG.debug("exchange {} on {}",exchange,this);
try
{
// Should we commit the request?
if (!_generator.isCommitted() && exchange!=null && exchange.getStatus() == HttpExchange.STATUS_WAITING_FOR_COMMIT)
{
LOG.debug("commit");
LOG.debug("commit {}",exchange);
progress=true;
commitRequest();
}
@ -83,7 +83,7 @@ public class AsyncHttpConnection extends AbstractHttpConnection implements Async
if (_requestContentChunk==null)
{
LOG.debug("complete");
LOG.debug("complete {}",exchange);
progress=true;
_generator.complete();
}
@ -101,7 +101,7 @@ public class AsyncHttpConnection extends AbstractHttpConnection implements Async
// Signal request completion
if (_generator.isComplete() && !_requestComplete)
{
LOG.debug("requestComplete");
LOG.debug("requestComplete {}",exchange);
progress=true;
_requestComplete = true;
exchange.getEventListener().onRequestComplete();
@ -121,7 +121,7 @@ public class AsyncHttpConnection extends AbstractHttpConnection implements Async
// Has any IO been done by the endpoint itself since last loop
if (_asyncEndp.hasProgressed())
{
LOG.debug("hasProgressed");
LOG.debug("hasProgressed {}",exchange);
progress=true;
}
}
@ -162,8 +162,7 @@ public class AsyncHttpConnection extends AbstractHttpConnection implements Async
}
finally
{
LOG.debug("{} {} progress={}",_generator, _parser,progress);
LOG.debug("{}",_endp);
LOG.debug("finally {} on {} progress={} {}",exchange,this,progress,_endp);
boolean complete = failed || _generator.isComplete() && _parser.isComplete();
@ -227,6 +226,7 @@ public class AsyncHttpConnection extends AbstractHttpConnection implements Async
{
_parser.returnBuffers();
_generator.returnBuffers();
LOG.debug("unhandle {} on {}",_exchange,_endp);
}
return connection;

View File

@ -428,6 +428,7 @@ public class HttpDestination implements Dumpable
synchronized (this)
{
_connections.remove(connection);
System.err.println("Q "+_queue);
if (!_queue.isEmpty())
startConnection = true;
}

View File

@ -196,7 +196,7 @@ public class HttpExchange
if (newStatus==STATUS_SENDING_REQUEST)
_sent=_lastStateChange;
}
// State machine: from which old status you can go into which new status
switch (oldStatus)
{
@ -357,6 +357,7 @@ public class HttpExchange
if (!set)
throw new IllegalStateException(toState(oldStatus) + " => " + toState(newStatus));
LOG.debug("setStatus {} {}",newStatus,this);
}
catch (IOException x)
{

View File

@ -20,7 +20,7 @@ import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.eclipse.jetty.http.HttpStatus;
import org.eclipse.jetty.server.HttpConnection;
import org.eclipse.jetty.server.AbstractHttpConnection;
import org.eclipse.jetty.server.Request;
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.server.handler.ConnectHandler;
@ -68,7 +68,16 @@ public class HttpsViaBrokenHttpProxyTest
@Test
public void httpsViaProxyThatClosesConnectionOnConnectRequestTest() throws Exception
{
sendRequestThroughProxy(new ContentExchange(), "close", 9);
sendRequestThroughProxy(new ContentExchange()
{
@Override
protected void onException(Throwable x)
{
}
}, "close", 9);
}
@Test
@ -110,7 +119,7 @@ public class HttpsViaBrokenHttpProxyTest
{
if (serverAddress.contains("close"))
{
HttpConnection.getCurrentConnection().getEndPoint().close();
AbstractHttpConnection.getCurrentConnection().getEndPoint().close();
}
else if (serverAddress.contains("error500"))
{

View File

@ -1378,7 +1378,7 @@ public class SslContextFactory extends AbstractLifeCycle
/** Set the trust store resource.
* @param resource the trust store resource to set
*/
public void setTrustStore(Resource resource)
public void setTrustStoreResource(Resource resource)
{
checkNotStarted();

View File

@ -13,8 +13,7 @@
package org.eclipse.jetty.util.log;
import static org.hamcrest.Matchers.containsString;
import static org.hamcrest.Matchers.not;
import static org.hamcrest.Matchers.*;
import java.io.ByteArrayOutputStream;
import java.io.PrintStream;