fix for null pointer exception during shut-down

git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@1415 6c8d7289-2bf4-0310-a012-ef5d649a1542
pull/1/head
orbiter 19 years ago
parent 47843e69e2
commit eabf4a0386

@ -768,7 +768,7 @@ public final class plasmaSwitchboard extends serverAbstractSwitch implements ser
public void close() { public void close() {
log.logConfig("SWITCHBOARD SHUTDOWN STEP 1: sending termination signal to managed threads:"); log.logConfig("SWITCHBOARD SHUTDOWN STEP 1: sending termination signal to managed threads:");
terminateAllThreads(true); terminateAllThreads(true);
log.logConfig("SWITCHBOARD SHUTDOWN STEP 2: sending termination signal to database manager"); log.logConfig("SWITCHBOARD SHUTDOWN STEP 2: sending termination signal to threaded indexing");
// closing all still running db importer jobs // closing all still running db importer jobs
plasmaDbImporter.close(); plasmaDbImporter.close();
indexDistribution.close(); indexDistribution.close();
@ -779,15 +779,15 @@ public final class plasmaSwitchboard extends serverAbstractSwitch implements ser
messageDB.close(); messageDB.close();
if (facilityDB != null) try {facilityDB.close();} catch (IOException e) {} if (facilityDB != null) try {facilityDB.close();} catch (IOException e) {}
sbStackCrawlThread.close(); sbStackCrawlThread.close();
urlPool.close();
profiles.close(); profiles.close();
robots.close(); robots.close();
parser.close(); parser.close();
cacheManager.close(); cacheManager.close();
sbQueue.close(); sbQueue.close();
flushCitationReference(crg, "crg"); flushCitationReference(crg, "crg");
log.logConfig("SWITCHBOARD SHUTDOWN STEP 3: sending termination signal to threaded indexing (stand by...)"); log.logConfig("SWITCHBOARD SHUTDOWN STEP 3: sending termination signal to database manager (stand by...)");
int waitingBoundSeconds = Integer.parseInt(getConfig("maxWaitingWordFlush", "120")); int waitingBoundSeconds = Integer.parseInt(getConfig("maxWaitingWordFlush", "120"));
urlPool.close();
wordIndex.close(waitingBoundSeconds); wordIndex.close(waitingBoundSeconds);
log.logConfig("SWITCHBOARD SHUTDOWN TERMINATED"); log.logConfig("SWITCHBOARD SHUTDOWN TERMINATED");
} }

@ -498,15 +498,17 @@ public final class plasmaWordIndexCache implements plasmaWordIndexInterface {
public void close(int waitingSeconds) { public void close(int waitingSeconds) {
// stop permanent flushing // stop permanent flushing
flushThread.terminate(); flushThread.terminate();
try {flushThread.join(5000);} catch (InterruptedException e) {} try {flushThread.join(6000);} catch (InterruptedException e) {}
// close cluster // dump cache
assortmentCluster.close();
try { try {
dump(waitingSeconds); dump(waitingSeconds);
} catch (IOException e){ } catch (IOException e){
log.logSevere("unable to dump cache: " + e.getMessage(), e); log.logSevere("unable to dump cache: " + e.getMessage(), e);
} }
// close cluster
assortmentCluster.close();
} }
public Object migrateWords2Assortment(String wordhash) throws IOException { public Object migrateWords2Assortment(String wordhash) throws IOException {

Loading…
Cancel
Save