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

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

Loading…
Cancel
Save