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; package org.eclipse.jetty.embedded;
import static org.junit.Assert.assertTrue;
import java.io.IOException; import java.io.IOException;
import java.lang.management.ManagementFactory; import java.lang.management.ManagementFactory;
import java.util.concurrent.CountDownLatch; 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 public boolean send(HttpExchange ex) throws IOException
{ {
LOG.debug("Send {} on {}",ex,this);
synchronized (this) synchronized (this)
{ {
if (_exchange != null) if (_exchange != null)
@ -346,6 +347,7 @@ public abstract class AbstractHttpConnection extends AbstractConnection implemen
if (exchange!=null) if (exchange!=null)
{ {
exchange.setStatus(HttpExchange.STATUS_EXCEPTED); 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 we are making progress and have not changed connection
while (progress && connection==this) 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; progress=false;
HttpExchange exchange=_exchange; HttpExchange exchange=_exchange;
LOG.debug("exchange {}",exchange); LOG.debug("exchange {} on {}",exchange,this);
try try
{ {
// Should we commit the request? // Should we commit the request?
if (!_generator.isCommitted() && exchange!=null && exchange.getStatus() == HttpExchange.STATUS_WAITING_FOR_COMMIT) if (!_generator.isCommitted() && exchange!=null && exchange.getStatus() == HttpExchange.STATUS_WAITING_FOR_COMMIT)
{ {
LOG.debug("commit"); LOG.debug("commit {}",exchange);
progress=true; progress=true;
commitRequest(); commitRequest();
} }
@ -83,7 +83,7 @@ public class AsyncHttpConnection extends AbstractHttpConnection implements Async
if (_requestContentChunk==null) if (_requestContentChunk==null)
{ {
LOG.debug("complete"); LOG.debug("complete {}",exchange);
progress=true; progress=true;
_generator.complete(); _generator.complete();
} }
@ -101,7 +101,7 @@ public class AsyncHttpConnection extends AbstractHttpConnection implements Async
// Signal request completion // Signal request completion
if (_generator.isComplete() && !_requestComplete) if (_generator.isComplete() && !_requestComplete)
{ {
LOG.debug("requestComplete"); LOG.debug("requestComplete {}",exchange);
progress=true; progress=true;
_requestComplete = true; _requestComplete = true;
exchange.getEventListener().onRequestComplete(); 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 // Has any IO been done by the endpoint itself since last loop
if (_asyncEndp.hasProgressed()) if (_asyncEndp.hasProgressed())
{ {
LOG.debug("hasProgressed"); LOG.debug("hasProgressed {}",exchange);
progress=true; progress=true;
} }
} }
@ -162,8 +162,7 @@ public class AsyncHttpConnection extends AbstractHttpConnection implements Async
} }
finally finally
{ {
LOG.debug("{} {} progress={}",_generator, _parser,progress); LOG.debug("finally {} on {} progress={} {}",exchange,this,progress,_endp);
LOG.debug("{}",_endp);
boolean complete = failed || _generator.isComplete() && _parser.isComplete(); boolean complete = failed || _generator.isComplete() && _parser.isComplete();
@ -227,6 +226,7 @@ public class AsyncHttpConnection extends AbstractHttpConnection implements Async
{ {
_parser.returnBuffers(); _parser.returnBuffers();
_generator.returnBuffers(); _generator.returnBuffers();
LOG.debug("unhandle {} on {}",_exchange,_endp);
} }
return connection; return connection;

View File

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

View File

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

View File

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

View File

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

View File

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