in nailgun-server/src/main/java/com/facebook/nailgun/NGSession.java [190:225]
public void run() {
updateThreadName(null);
LOG.log(Level.FINE, "NGSession {0} is waiting for first client to connect", instanceNumber);
Socket socket = nextSocket();
while (socket != null) {
LOG.log(Level.FINE, "NGSession {0} accepted new connection", instanceNumber);
try (NGCommunicator comm = communicatorCreator.get(socket)) {
runImpl(comm, socket);
} catch (Throwable t) {
LOG.log(Level.WARNING, "Internal error in NGSession " + instanceNumber, t);
}
LOG.log(Level.FINEST, "NGSession {0} started cleanup", instanceNumber);
if (System.in instanceof ThreadLocalInputStream) {
((ThreadLocalInputStream) System.in).init(null);
((ThreadLocalPrintStream) System.out).init(null);
((ThreadLocalPrintStream) System.err).init(null);
}
LOG.log(Level.FINE, "NGSession {0} is closing client socket", instanceNumber);
try {
socket.close();
} catch (Throwable t) {
LOG.log(Level.WARNING, "Internal error closing socket", t);
}
updateThreadName(null);
sessionPool.give(this);
socket = nextSocket();
}
LOG.log(Level.FINE, "NGSession {0} stopped", instanceNumber);
}