Skip to content
Permalink
Browse files
[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 a709000b18fea71d10391d9d20549e711e8820b4
Showing with 15 additions and 3 deletions.
  1. +15 −3 src/java/winstone/RequestHandlerThread.java
@@ -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();
@@ -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());

0 comments on commit a709000

Please sign in to comment.