Fix logging in serverCore

Prevent NPEs from keeping stopped Sessions in the pool and blocking slots



git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@5625 6c8d7289-2bf4-0310-a012-ef5d649a1542
pull/1/head
hermens 16 years ago
parent d30456e2c8
commit 02dfd6183b

@ -532,7 +532,7 @@ public final class serverCore extends serverAbstractBusyThread implements server
if (this.controlSocket != null) try {
this.controlSocket.close();
serverCore.this.log.logInfo("Closing main socket of thread '" + this.getName() + "'");
this.controlSocket = null;
//this.controlSocket = null;
} catch (final Exception e) {}
}
@ -620,24 +620,23 @@ public final class serverCore extends serverAbstractBusyThread implements server
System.err.println("ERROR: (internal) " + e);
} finally {
try {
if ((this.controlSocket == null) || this.controlSocket.isClosed()) return;
// flush data
this.out.flush();
if ((this.controlSocket != null) && (! this.controlSocket.isClosed())) {
// flush data
this.out.flush();
// maybe this doesn't work for all SSL socket implementations
if (!(this.controlSocket instanceof SSLSocket)) {
this.controlSocket.shutdownInput();
this.controlSocket.shutdownOutput();
}
// maybe this doesn't work for all SSL socket implementations
if (!(this.controlSocket instanceof SSLSocket)) {
this.controlSocket.shutdownInput();
this.controlSocket.shutdownOutput();
}
// close streams
this.in.close();
this.out.close();
// close streams
this.in.close();
this.out.close();
// close everything
this.controlSocket.close();
// close everything
this.controlSocket.close();
}
} catch (final IOException e) {
e.printStackTrace();
}

@ -338,6 +338,8 @@ public final class yacy {
// first start the server
sb.deployThread("10_httpd", "HTTPD Server/Proxy", "the HTTPD, used as web server and proxy", null, server, 0, 0, 0, 0);
//server.start();
// repair log settings, gets overwritten with "PLASMA" in deployThread
server.setLog(new Log("SERVER"));
// open the browser window
final boolean browserPopUpTrigger = sb.getConfig(plasmaSwitchboardConstants.BROWSER_POP_UP_TRIGGER, "true").equals("true");

Loading…
Cancel
Save