Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[JENKINS-16474]
For better diagnosability, report the remote client IP address when blocking
  • Loading branch information
kohsuke committed Feb 12, 2013
1 parent 3079a06 commit a709000
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions src/java/winstone/RequestHandlerThread.java
Expand Up @@ -55,6 +55,8 @@ public void run() {
OutputStream outSocket = null;
boolean iAmFirst = true;
try {
int requestCount = 0;

// Get input/output streams
inSocket = socket.getInputStream();
outSocket = socket.getOutputStream();
Expand All @@ -72,9 +74,19 @@ public void run() {
rsp, inData, outData);
continue;
}
String servletURI = this.listener.parseURI(this,
this.req, this.rsp, this.inData, this.socket,
iAmFirst);

String servletURI;
String oldName = Thread.currentThread().getName();
Thread.currentThread().setName(String.format("%s : reading request #%d from %s",
oldName, requestCount++, socket.getRemoteSocketAddress()));

This comment has been minimized.

Copy link
@jglick

jglick Feb 13, 2013

Member

Ah, clever alternative to logging.

try {
servletURI = this.listener.parseURI(this,
this.req, this.rsp, this.inData, this.socket,
iAmFirst);
} finally {
Thread.currentThread().setName(oldName);
}

if (servletURI == null) {
Logger.log(Logger.FULL_DEBUG, Launcher.RESOURCES,
"RequestHandlerThread.KeepAliveTimedOut", Thread.currentThread().getName());
Expand Down

0 comments on commit a709000

Please sign in to comment.