From 02dfd6183bef57ccd69db5cb50b16a58359384f7 Mon Sep 17 00:00:00 2001 From: hermens Date: Fri, 20 Feb 2009 18:54:01 +0000 Subject: [PATCH] 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 --- source/de/anomic/server/serverCore.java | 31 ++++++++++++------------- source/yacy.java | 2 ++ 2 files changed, 17 insertions(+), 16 deletions(-) diff --git a/source/de/anomic/server/serverCore.java b/source/de/anomic/server/serverCore.java index dc4fe7b01..9a44ed5e5 100644 --- a/source/de/anomic/server/serverCore.java +++ b/source/de/anomic/server/serverCore.java @@ -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(); } diff --git a/source/yacy.java b/source/yacy.java index d143ded05..9879061ed 100644 --- a/source/yacy.java +++ b/source/yacy.java @@ -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");