You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by jb...@apache.org on 2009/05/05 08:57:17 UTC
svn commit: r771591 - in
/incubator/cassandra/trunk/src/java/org/apache/cassandra/net/http:
HttpConnection.java HttpRequestHandler.java HttpWriteResponse.java
Author: jbellis
Date: Tue May 5 06:57:16 2009
New Revision: 771591
URL: http://svn.apache.org/viewvc?rev=771591&view=rev
Log:
add logging for httpconnection to troubleshoot #133. patch by jbellis
Modified:
incubator/cassandra/trunk/src/java/org/apache/cassandra/net/http/HttpConnection.java
incubator/cassandra/trunk/src/java/org/apache/cassandra/net/http/HttpRequestHandler.java
incubator/cassandra/trunk/src/java/org/apache/cassandra/net/http/HttpWriteResponse.java
Modified: incubator/cassandra/trunk/src/java/org/apache/cassandra/net/http/HttpConnection.java
URL: http://svn.apache.org/viewvc/incubator/cassandra/trunk/src/java/org/apache/cassandra/net/http/HttpConnection.java?rev=771591&r1=771590&r2=771591&view=diff
==============================================================================
--- incubator/cassandra/trunk/src/java/org/apache/cassandra/net/http/HttpConnection.java (original)
+++ incubator/cassandra/trunk/src/java/org/apache/cassandra/net/http/HttpConnection.java Tue May 5 06:57:16 2009
@@ -81,7 +81,7 @@
private List<ByteBuffer> bodyBuffers_ = new LinkedList<ByteBuffer>();
private boolean shouldClose_ = false;
private String defaultContentType_ = "text/html";
- private org.apache.cassandra.net.http.HttpRequest currentRequest_ = null;
+ private HttpRequest currentRequest_ = null;
private HttpResponse currentResponse_ = null;
private HttpStartLineParser startLineParser_ = new HttpStartLineParser(this);
private HttpHeaderParser headerParser_ = new HttpHeaderParser(this);
@@ -174,7 +174,7 @@
{
try
{
- logger_.debug("Processing http requests from socket ...");
+ logger_.debug("Processing http request from socket ...");
switch (parseState_)
{
case IN_NEW:
@@ -298,9 +298,9 @@
if (done)
{
+ logger_.debug("... done parsing request for " + currentRequest_.getPath());
if (currentMsgType_ == HttpMessageType.REQUEST)
{
- //currentRequest_.setParseTime(env_.getCurrentTime() - parseStartTime_);
currentRequest_.setBody(bodyBuffers_);
if (currentRequest_.getHeader("Content-Type") == null)
@@ -312,12 +312,11 @@
}
else if (currentMsgType_ == HttpMessageType.RESPONSE)
{
- logger_.info("Holy shit! We are not supposed to be here - ever !!!");
+ logger_.error("Holy shit! We are not supposed to be processing responses here!");
}
else
{
- logger_.error("Http message type is still" +
- " unset after we finish parsing the body?");
+ logger_.error("Http message type is still unset after we finish parsing the body?");
}
resetParserState();
@@ -325,10 +324,9 @@
}
}
- catch (final Throwable e)
+ catch (Exception e)
{
- logger_.warn(LogUtil.throwableToString(e));
- //close();
+ throw new RuntimeException(e);
}
finally
{
Modified: incubator/cassandra/trunk/src/java/org/apache/cassandra/net/http/HttpRequestHandler.java
URL: http://svn.apache.org/viewvc/incubator/cassandra/trunk/src/java/org/apache/cassandra/net/http/HttpRequestHandler.java?rev=771591&r1=771590&r2=771591&view=diff
==============================================================================
--- incubator/cassandra/trunk/src/java/org/apache/cassandra/net/http/HttpRequestHandler.java (original)
+++ incubator/cassandra/trunk/src/java/org/apache/cassandra/net/http/HttpRequestHandler.java Tue May 5 06:57:16 2009
@@ -86,6 +86,7 @@
public void run()
{
+ logger_.debug("Handling " + request_.getMethod());
HttpWriteResponse httpServerResponse = new HttpWriteResponse(request_);
if(request_.getMethod().toUpperCase().equals("GET"))
{
@@ -100,14 +101,8 @@
// write the response we have constructed into the socket
ByteBuffer buffer = null;
- try
- {
- buffer = httpServerResponse.flush();
- }
- catch (Exception e)
- {
- throw new RuntimeException(e);
- }
+ buffer = httpServerResponse.flush();
+ logger_.debug("http response is " + buffer.limit() + " bytes");
request_.getHttpConnection().write(buffer);
}
Modified: incubator/cassandra/trunk/src/java/org/apache/cassandra/net/http/HttpWriteResponse.java
URL: http://svn.apache.org/viewvc/incubator/cassandra/trunk/src/java/org/apache/cassandra/net/http/HttpWriteResponse.java?rev=771591&r1=771590&r2=771591&view=diff
==============================================================================
--- incubator/cassandra/trunk/src/java/org/apache/cassandra/net/http/HttpWriteResponse.java (original)
+++ incubator/cassandra/trunk/src/java/org/apache/cassandra/net/http/HttpWriteResponse.java Tue May 5 06:57:16 2009
@@ -49,7 +49,7 @@
}
}
- public ByteBuffer flush() throws Exception
+ public ByteBuffer flush()
{
StringBuilder sb = new StringBuilder();
// write out the HTTP response headers first