|
@@ -548,14 +548,14 @@ public abstract class Server {
|
|
|
|
|
|
@Override
|
|
|
public void run() {
|
|
|
- LOG.info("Starting " + getName());
|
|
|
+ LOG.info("Starting " + Thread.currentThread().getName());
|
|
|
try {
|
|
|
doRunLoop();
|
|
|
} finally {
|
|
|
try {
|
|
|
readSelector.close();
|
|
|
} catch (IOException ioe) {
|
|
|
- LOG.error("Error closing read selector in " + this.getName(), ioe);
|
|
|
+ LOG.error("Error closing read selector in " + Thread.currentThread().getName(), ioe);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -586,7 +586,7 @@ public abstract class Server {
|
|
|
}
|
|
|
} catch (InterruptedException e) {
|
|
|
if (running) { // unexpected -- log it
|
|
|
- LOG.info(getName() + " unexpectedly interrupted", e);
|
|
|
+ LOG.info(Thread.currentThread().getName() + " unexpectedly interrupted", e);
|
|
|
}
|
|
|
} catch (IOException ex) {
|
|
|
LOG.error("Error in Reader", ex);
|
|
@@ -617,7 +617,7 @@ public abstract class Server {
|
|
|
|
|
|
@Override
|
|
|
public void run() {
|
|
|
- LOG.info(getName() + ": starting");
|
|
|
+ LOG.info(Thread.currentThread().getName() + ": starting");
|
|
|
SERVER.set(Server.this);
|
|
|
connectionManager.startIdleScan();
|
|
|
while (running) {
|
|
@@ -649,7 +649,7 @@ public abstract class Server {
|
|
|
closeCurrentConnection(key, e);
|
|
|
}
|
|
|
}
|
|
|
- LOG.info("Stopping " + this.getName());
|
|
|
+ LOG.info("Stopping " + Thread.currentThread().getName());
|
|
|
|
|
|
synchronized (this) {
|
|
|
try {
|
|
@@ -707,14 +707,14 @@ public abstract class Server {
|
|
|
try {
|
|
|
count = c.readAndProcess();
|
|
|
} catch (InterruptedException ieo) {
|
|
|
- LOG.info(getName() + ": readAndProcess caught InterruptedException", ieo);
|
|
|
+ LOG.info(Thread.currentThread().getName() + ": readAndProcess caught InterruptedException", ieo);
|
|
|
throw ieo;
|
|
|
} catch (Exception e) {
|
|
|
// a WrappedRpcServerException is an exception that has been sent
|
|
|
// to the client, so the stacktrace is unnecessary; any other
|
|
|
// exceptions are unexpected internal server errors and thus the
|
|
|
// stacktrace should be logged
|
|
|
- LOG.info(getName() + ": readAndProcess from client " +
|
|
|
+ LOG.info(Thread.currentThread().getName() + ": readAndProcess from client " +
|
|
|
c.getHostAddress() + " threw exception [" + e + "]",
|
|
|
(e instanceof WrappedRpcServerException) ? null : e);
|
|
|
count = -1; //so that the (count < 0) block is executed
|
|
@@ -737,7 +737,7 @@ public abstract class Server {
|
|
|
try {
|
|
|
acceptChannel.socket().close();
|
|
|
} catch (IOException e) {
|
|
|
- LOG.info(getName() + ":Exception in closing listener socket. " + e);
|
|
|
+ LOG.info(Thread.currentThread().getName() + ":Exception in closing listener socket. " + e);
|
|
|
}
|
|
|
}
|
|
|
for (Reader r : readers) {
|
|
@@ -770,16 +770,16 @@ public abstract class Server {
|
|
|
|
|
|
@Override
|
|
|
public void run() {
|
|
|
- LOG.info(getName() + ": starting");
|
|
|
+ LOG.info(Thread.currentThread().getName() + ": starting");
|
|
|
SERVER.set(Server.this);
|
|
|
try {
|
|
|
doRunLoop();
|
|
|
} finally {
|
|
|
- LOG.info("Stopping " + this.getName());
|
|
|
+ LOG.info("Stopping " + Thread.currentThread().getName());
|
|
|
try {
|
|
|
writeSelector.close();
|
|
|
} catch (IOException ioe) {
|
|
|
- LOG.error("Couldn't close write selector in " + this.getName(), ioe);
|
|
|
+ LOG.error("Couldn't close write selector in " + Thread.currentThread().getName(), ioe);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -800,7 +800,7 @@ public abstract class Server {
|
|
|
doAsyncWrite(key);
|
|
|
}
|
|
|
} catch (IOException e) {
|
|
|
- LOG.info(getName() + ": doAsyncWrite threw exception " + e);
|
|
|
+ LOG.info(Thread.currentThread().getName() + ": doAsyncWrite threw exception " + e);
|
|
|
}
|
|
|
}
|
|
|
long now = Time.now();
|
|
@@ -915,7 +915,7 @@ public abstract class Server {
|
|
|
call = responseQueue.removeFirst();
|
|
|
SocketChannel channel = call.connection.channel;
|
|
|
if (LOG.isDebugEnabled()) {
|
|
|
- LOG.debug(getName() + ": responding to " + call);
|
|
|
+ LOG.debug(Thread.currentThread().getName() + ": responding to " + call);
|
|
|
}
|
|
|
//
|
|
|
// Send as much data as we can in the non-blocking fashion
|
|
@@ -934,7 +934,7 @@ public abstract class Server {
|
|
|
done = false; // more calls pending to be sent.
|
|
|
}
|
|
|
if (LOG.isDebugEnabled()) {
|
|
|
- LOG.debug(getName() + ": responding to " + call
|
|
|
+ LOG.debug(Thread.currentThread().getName() + ": responding to " + call
|
|
|
+ " Wrote " + numBytes + " bytes.");
|
|
|
}
|
|
|
} else {
|
|
@@ -962,7 +962,7 @@ public abstract class Server {
|
|
|
}
|
|
|
}
|
|
|
if (LOG.isDebugEnabled()) {
|
|
|
- LOG.debug(getName() + ": responding to " + call
|
|
|
+ LOG.debug(Thread.currentThread().getName() + ": responding to " + call
|
|
|
+ " Wrote partial " + numBytes + " bytes.");
|
|
|
}
|
|
|
}
|
|
@@ -970,7 +970,7 @@ public abstract class Server {
|
|
|
}
|
|
|
} finally {
|
|
|
if (error && call != null) {
|
|
|
- LOG.warn(getName()+", call " + call + ": output error");
|
|
|
+ LOG.warn(Thread.currentThread().getName()+", call " + call + ": output error");
|
|
|
done = true; // error. no more data for this channel.
|
|
|
closeConnection(call.connection);
|
|
|
}
|
|
@@ -1925,7 +1925,7 @@ public abstract class Server {
|
|
|
|
|
|
@Override
|
|
|
public void run() {
|
|
|
- LOG.debug(getName() + ": starting");
|
|
|
+ LOG.debug(Thread.currentThread().getName() + ": starting");
|
|
|
SERVER.set(Server.this);
|
|
|
ByteArrayOutputStream buf =
|
|
|
new ByteArrayOutputStream(INITIAL_RESP_BUF_SIZE);
|
|
@@ -1933,7 +1933,7 @@ public abstract class Server {
|
|
|
try {
|
|
|
final Call call = callQueue.take(); // pop the queue; maybe blocked here
|
|
|
if (LOG.isDebugEnabled()) {
|
|
|
- LOG.debug(getName() + ": " + call + " for RpcKind " + call.rpcKind);
|
|
|
+ LOG.debug(Thread.currentThread().getName() + ": " + call + " for RpcKind " + call.rpcKind);
|
|
|
}
|
|
|
String errorClass = null;
|
|
|
String error = null;
|
|
@@ -1966,7 +1966,7 @@ public abstract class Server {
|
|
|
if (e instanceof UndeclaredThrowableException) {
|
|
|
e = e.getCause();
|
|
|
}
|
|
|
- String logMsg = getName() + ", call " + call + ": error: " + e;
|
|
|
+ String logMsg = Thread.currentThread().getName() + ", call " + call + ": error: " + e;
|
|
|
if (e instanceof RuntimeException || e instanceof Error) {
|
|
|
// These exception types indicate something is probably wrong
|
|
|
// on the server side, as opposed to just a normal exceptional
|
|
@@ -2015,13 +2015,13 @@ public abstract class Server {
|
|
|
}
|
|
|
} catch (InterruptedException e) {
|
|
|
if (running) { // unexpected -- log it
|
|
|
- LOG.info(getName() + " unexpectedly interrupted", e);
|
|
|
+ LOG.info(Thread.currentThread().getName() + " unexpectedly interrupted", e);
|
|
|
}
|
|
|
} catch (Exception e) {
|
|
|
- LOG.info(getName() + " caught an exception", e);
|
|
|
+ LOG.info(Thread.currentThread().getName() + " caught an exception", e);
|
|
|
}
|
|
|
}
|
|
|
- LOG.debug(getName() + ": exiting");
|
|
|
+ LOG.debug(Thread.currentThread().getName() + ": exiting");
|
|
|
}
|
|
|
|
|
|
}
|