Skip to content

Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance

fixed shutdown problem this fixes the 'inconsistency' messages during start-up

orbiter6ad39bae1e87
diff --git a/source/dbtest.java b/source/dbtest.java
index 129614913..ce40aa2a0 100644
--- a/source/dbtest.java
+++ b/source/dbtest.java
@@ -8,6 +8,7 @@ import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
+import java.sql.SQLException;
import java.util.Date;
import java.util.Iterator;
import java.util.List;
@@ -461,12 +462,13 @@ final class dbTable implements kelondroIndex {
return "dbtest." + theDBConnection.hashCode();
}
- public void close() throws IOException {
- try {
+ public void close() {
+ if (this.theDBConnection != null) try {
this.theDBConnection.close();
- } catch (Exception e) {
- throw new IOException("Unable to close the database connection.");
+ } catch (SQLException e) {
+ e.printStackTrace();
}
+ this.theDBConnection = null;
}
public int size() throws IOException {
diff --git a/source/de/anomic/data/blogBoard.java b/source/de/anomic/data/blogBoard.java
index f933ebf96..32492ec8d 100644
--- a/source/de/anomic/data/blogBoard.java
+++ b/source/de/anomic/data/blogBoard.java
@@ -93,7 +93,7 @@ public class blogBoard {
}
public void close() {
- try {datbase.close();} catch (IOException e) {}
+ datbase.close();
}
private static String dateString(Date date) {
diff --git a/source/de/anomic/data/blogBoardComments.java b/source/de/anomic/data/blogBoardComments.java
index 510e57177..730a9baba 100644
--- a/source/de/anomic/data/blogBoardComments.java
+++ b/source/de/anomic/data/blogBoardComments.java
@@ -93,7 +93,7 @@ public class blogBoardComments {
}
public void close() {
- try {datbase.close();} catch (IOException e) {}
+ datbase.close();
}
private static String dateString(Date date) {
diff --git a/source/de/anomic/data/bookmarksDB.java b/source/de/anomic/data/bookmarksDB.java
index 04aa5ec51..5cdfbdefb 100644
--- a/source/de/anomic/data/bookmarksDB.java
+++ b/source/de/anomic/data/bookmarksDB.java
@@ -152,29 +152,26 @@ public class bookmarksDB {
}
public void close(){
- try {
- //flushBookmarkCache();
- bookmarksTable.close();
- } catch (IOException e) {}
- try {
- flushTagCache();
- tagsTable.close();
- } catch (IOException e) {}
- try {
- datesTable.close();
- } catch (IOException e) {}
+ bookmarksTable.close();
+ flushTagCache();
+ tagsTable.close();
+ datesTable.close();
}
+
public int bookmarksSize(){
return bookmarksTable.size();
}
+
public int tagSize(boolean flushed){
if(flushed)
flushTagCache();
return tagsTable.size();
}
+
public int tagsSize(){
return tagSize(false);
}
+
public void saveBookmark(Bookmark bookmark){
try {
bookmarksTable.set(bookmark.getUrlHash(), bookmark);
diff --git a/source/de/anomic/data/messageBoard.java b/source/de/anomic/data/messageBoard.java
index 103f3eb5f..ee2a3f1aa 100644
--- a/source/de/anomic/data/messageBoard.java
+++ b/source/de/anomic/data/messageBoard.java
@@ -80,7 +80,7 @@ public class messageBoard {
}
public void close() {
- try {database.close();} catch (IOException e) {}
+ database.close();
}
private static String dateString() {
diff --git a/source/de/anomic/data/userDB.java b/source/de/anomic/data/userDB.java
index 1c74ccf04..1e282855a 100644
--- a/source/de/anomic/data/userDB.java
+++ b/source/de/anomic/data/userDB.java
@@ -82,18 +82,14 @@ public final class userDB {
void resetDatabase() {
// deletes the database and creates a new one
- if (userTable != null) try {
- userTable.close();
- } catch (IOException e) {}
+ if (userTable != null) userTable.close();
if (!(userTableFile.delete())) throw new RuntimeException("cannot delete user database");
userTableFile.getParentFile().mkdirs();
userTable = new kelondroMapObjects(kelondroDyn.open(userTableFile, true, true, preloadTime, 256, 512, '_', true, false), 10);
}
public void close() {
- try {
- userTable.close();
- } catch (IOException e) {}
+ userTable.close();
}
public int size() {
diff --git a/source/de/anomic/data/wikiBoard.java b/source/de/anomic/data/wikiBoard.java
index 620d98e26..98d9ee3cf 100644
--- a/source/de/anomic/data/wikiBoard.java
+++ b/source/de/anomic/data/wikiBoard.java
@@ -88,8 +88,8 @@ public class wikiBoard {
}
public void close() {
- try {datbase.close();} catch (IOException e) {}
- try {bkpbase.close();} catch (IOException e) {}
+ datbase.close();
+ bkpbase.close();
}
private static String dateString() {
diff --git a/source/de/anomic/kelondro/kelondroBytesIntMap.java b/source/de/anomic/kelondro/kelondroBytesIntMap.java
index 2f5adfdb8..766b341cd 100644
--- a/source/de/anomic/kelondro/kelondroBytesIntMap.java
+++ b/source/de/anomic/kelondro/kelondroBytesIntMap.java
@@ -102,7 +102,7 @@ public class kelondroBytesIntMap {
return ki.profile();
}
- public synchronized void close() throws IOException {
+ public synchronized void close() {
ki.close();
}
diff --git a/source/de/anomic/kelondro/kelondroCache.java b/source/de/anomic/kelondro/kelondroCache.java
index 859547cdc..dfd4e700c 100644
--- a/source/de/anomic/kelondro/kelondroCache.java
+++ b/source/de/anomic/kelondro/kelondroCache.java
@@ -260,9 +260,17 @@ public class kelondroCache implements kelondroIndex {
}
}
- public synchronized void close() throws IOException {
- flushUnique();
- flushDoubles();
+ public synchronized void close() {
+ try {
+ flushUnique();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ try {
+ flushDoubles();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
index.close();
readHitCache = null;
readMissCache = null;
diff --git a/source/de/anomic/kelondro/kelondroDyn.java b/source/de/anomic/kelondro/kelondroDyn.java
index 3a08a1ab3..53fdb6def 100644
--- a/source/de/anomic/kelondro/kelondroDyn.java
+++ b/source/de/anomic/kelondro/kelondroDyn.java
@@ -465,7 +465,7 @@ public class kelondroDyn {
}
}
- public synchronized void close() throws IOException {
+ public synchronized void close() {
index.close();
}
diff --git a/source/de/anomic/kelondro/kelondroFlexSplitTable.java b/source/de/anomic/kelondro/kelondroFlexSplitTable.java
index 6a2a343e3..759158c17 100644
--- a/source/de/anomic/kelondro/kelondroFlexSplitTable.java
+++ b/source/de/anomic/kelondro/kelondroFlexSplitTable.java
@@ -331,9 +331,12 @@ public class kelondroFlexSplitTable implements kelondroIndex {
return new int[]{0,0,0,0,0,0,0,0,0,0};
}
- public synchronized void close() throws IOException {
+ public synchronized void close() {
+ if (tables == null) return;
Iterator i = tables.values().iterator();
- while (i.hasNext()) ((kelondroIndex) i.next()).close();
+ while (i.hasNext()) {
+ ((kelondroIndex) i.next()).close();
+ }
tables = null;
}
diff --git a/source/de/anomic/kelondro/kelondroFlexTable.java b/source/de/anomic/kelondro/kelondroFlexTable.java
index ae7b2cfe5..c3def29eb 100644
--- a/source/de/anomic/kelondro/kelondroFlexTable.java
+++ b/source/de/anomic/kelondro/kelondroFlexTable.java
@@ -385,7 +385,7 @@ public class kelondroFlexTable extends kelondroFlexWidthArray implements kelondr
return map;
}
- public synchronized void close() throws IOException {
+ public synchronized void close() {
if (tableTracker.remove(this.filename) == null) {
serverLog.logWarning("kelondroFlexTable", "close(): file '" + this.filename + "' was not tracked with record tracker.");
}
@@ -395,4 +395,21 @@ public class kelondroFlexTable extends kelondroFlexWidthArray implements kelondr
super.close();
}
+ public static void main(String[] args) {
+ // open a file, add one entry and exit
+ File f = new File(args[0]);
+ String name = args[1];
+ kelondroRow row = new kelondroRow("Cardinal key-4 {b256}, byte[] x-64", kelondroNaturalOrder.naturalOrder, 0);
+ try {
+ kelondroFlexTable t = new kelondroFlexTable(f, name, 0, row);
+ kelondroRow.Entry entry = row.newEntry();
+ entry.setCol(0, System.currentTimeMillis());
+ entry.setCol(1, "dummy".getBytes());
+ t.put(entry);
+ t.close();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+
}
diff --git a/source/de/anomic/kelondro/kelondroFlexWidthArray.java b/source/de/anomic/kelondro/kelondroFlexWidthArray.java
index 16310e6cd..3d166d7de 100644
--- a/source/de/anomic/kelondro/kelondroFlexWidthArray.java
+++ b/source/de/anomic/kelondro/kelondroFlexWidthArray.java
@@ -161,7 +161,7 @@ public class kelondroFlexWidthArray implements kelondroArray {
}
}
- public void close() throws IOException {
+ public void close() {
synchronized (col) {
for (int i = 0; i < col.length; i++) {
if (col[i] != null) {
diff --git a/source/de/anomic/kelondro/kelondroIndex.java b/source/de/anomic/kelondro/kelondroIndex.java
index ae7ba343c..112c36598 100644
--- a/source/de/anomic/kelondro/kelondroIndex.java
+++ b/source/de/anomic/kelondro/kelondroIndex.java
@@ -71,5 +71,5 @@ public interface kelondroIndex {
public kelondroRow.Entry remove(byte[] key) throws IOException;
public kelondroRow.Entry removeOne() throws IOException;
public kelondroCloneableIterator rows(boolean up, byte[] firstKey) throws IOException;
- public void close() throws IOException;
+ public void close();
}
diff --git a/source/de/anomic/kelondro/kelondroMapObjects.java b/source/de/anomic/kelondro/kelondroMapObjects.java
index ba4c448b2..8e564d2f8 100644
--- a/source/de/anomic/kelondro/kelondroMapObjects.java
+++ b/source/de/anomic/kelondro/kelondroMapObjects.java
@@ -306,7 +306,7 @@ public class kelondroMapObjects extends kelondroObjects {
return super.size();
}
- public void close() throws IOException {
+ public void close() {
// close cluster
if (sortClusterMap != null) {
for (int i = 0; i < sortfields.length; i++) sortClusterMap.remove(sortfields[i]);
diff --git a/source/de/anomic/kelondro/kelondroMapTable.java b/source/de/anomic/kelondro/kelondroMapTable.java
index 493724511..85b6db431 100644
--- a/source/de/anomic/kelondro/kelondroMapTable.java
+++ b/source/de/anomic/kelondro/kelondroMapTable.java
@@ -183,7 +183,7 @@ public class kelondroMapTable {
throw new RuntimeException("kelondroTables.accumulator: table '" + tablename + "' does not exist.");
}
- public void close() throws IOException {
+ public void close() {
Iterator tablesIt = mTables.values().iterator();
while (tablesIt.hasNext()) ((kelondroMapObjects) tablesIt.next()).close();
mTables = null;
diff --git a/source/de/anomic/kelondro/kelondroObjects.java b/source/de/anomic/kelondro/kelondroObjects.java
index 16ca00c61..ebfe5c012 100644
--- a/source/de/anomic/kelondro/kelondroObjects.java
+++ b/source/de/anomic/kelondro/kelondroObjects.java
@@ -150,7 +150,7 @@ public class kelondroObjects {
}
}
- public void close() throws IOException {
+ public void close() {
// finish queue
//writeWorker.terminate(true);
diff --git a/source/de/anomic/kelondro/kelondroRecords.java b/source/de/anomic/kelondro/kelondroRecords.java
index 242789f6b..a773a9275 100644
--- a/source/de/anomic/kelondro/kelondroRecords.java
+++ b/source/de/anomic/kelondro/kelondroRecords.java
@@ -1470,7 +1470,7 @@ public class kelondroRecords {
}
- public synchronized void close() throws IOException {
+ public synchronized void close() {
if (cacheHeaders == null) {
if (recordTracker.get(this.filename) != null) {
theLogger.severe("close(): file '" + this.filename + "' was tracked with record tracker, but it should not.");
@@ -1482,19 +1482,20 @@ public class kelondroRecords {
}
if (entryFile == null) {
theLogger.severe("close(): file '" + this.filename + "' was closed before close was called.");
- } else {
+ } else try {
USAGE.writeused(true);
this.entryFile.close();
- this.entryFile = null;
- this.cacheHeaders = null;
theLogger.fine("file '" + this.filename + "' closed.");
+ } catch (IOException e) {
+ theLogger.severe("file '" + this.filename + "': failed to close.");
+ e.printStackTrace();
}
+ this.entryFile = null;
+ this.cacheHeaders = null;
}
public void finalize() {
- try {
- if (entryFile != null) close();
- } catch (IOException e) { }
+ if (entryFile != null) close();
this.entryFile = null;
}
diff --git a/source/de/anomic/kelondro/kelondroSplittedTree.java b/source/de/anomic/kelondro/kelondroSplittedTree.java
index e101defcb..5e0cc9aab 100644
--- a/source/de/anomic/kelondro/kelondroSplittedTree.java
+++ b/source/de/anomic/kelondro/kelondroSplittedTree.java
@@ -87,7 +87,7 @@ public class kelondroSplittedTree implements kelondroIndex {
ff = forkfactor;
}
- public void close() throws IOException {
+ public void close() {
for (int i = 0; i < ktfs.length; i++) ktfs[i].close();
}
diff --git a/source/de/anomic/plasma/plasmaCrawlBalancer.java b/source/de/anomic/plasma/plasmaCrawlBalancer.java
index e01753e11..354c3a19d 100644
--- a/source/de/anomic/plasma/plasmaCrawlBalancer.java
+++ b/source/de/anomic/plasma/plasmaCrawlBalancer.java
@@ -85,7 +85,7 @@ public class plasmaCrawlBalancer {
ramIndex = null;
while (sizeDomainStacks() > 0) flushOnceDomStacks(true);
try { flushAllRamStack(); } catch (IOException e) {}
- try { fileStack.close(); } catch (IOException e) {}
+ fileStack.close();
fileStack = null;
}
diff --git a/source/de/anomic/plasma/plasmaCrawlEURL.java b/source/de/anomic/plasma/plasmaCrawlEURL.java
index 8fa024db4..c68575cb7 100644
--- a/source/de/anomic/plasma/plasmaCrawlEURL.java
+++ b/source/de/anomic/plasma/plasmaCrawlEURL.java
@@ -173,10 +173,7 @@ public class plasmaCrawlEURL {
public void close() {
if (urlIndexFile != null) {
- try {
- urlIndexFile.close();
- } catch (IOException e) {
- }
+ urlIndexFile.close();
urlIndexFile = null;
}
}
diff --git a/source/de/anomic/plasma/plasmaCrawlLURL.java b/source/de/anomic/plasma/plasmaCrawlLURL.java
index 2a5876607..3521c138a 100644
--- a/source/de/anomic/plasma/plasmaCrawlLURL.java
+++ b/source/de/anomic/plasma/plasmaCrawlLURL.java
@@ -119,9 +119,9 @@ public final class plasmaCrawlLURL {
}
}
- public void close() throws IOException {
+ public void close() {
if (urlIndexFile != null) {
- urlIndexFile.close();
+ urlIndexFile.close();
urlIndexFile = null;
}
}
diff --git a/source/de/anomic/plasma/plasmaCrawlNURL.java b/source/de/anomic/plasma/plasmaCrawlNURL.java
index 36173430f..a4e81a52c 100644
--- a/source/de/anomic/plasma/plasmaCrawlNURL.java
+++ b/source/de/anomic/plasma/plasmaCrawlNURL.java
@@ -175,7 +175,7 @@ public class plasmaCrawlNURL {
private void resetHashCache() {
if (urlIndexFile != null) {
- try {urlIndexFile.close();} catch (IOException e) {}
+ urlIndexFile.close();
urlIndexFile = null;
File cacheFile = new File(cacheStacksPath, "urlNotice2.db");
cacheFile.delete();
@@ -188,13 +188,13 @@ public class plasmaCrawlNURL {
limitStack.close();
overhangStack.close();
remoteStack.close();
- try {imageStack.close();} catch (IOException e) {}
- try {movieStack.close();} catch (IOException e) {}
- try {musicStack.close();} catch (IOException e) {}
- if (urlIndexFile != null) try {
+ imageStack.close();
+ movieStack.close();
+ musicStack.close();
+ if (urlIndexFile != null) {
urlIndexFile.close();
urlIndexFile = null;
- } catch (IOException e) {}
+ }
}
public class initStackIndex extends Thread {
diff --git a/source/de/anomic/plasma/plasmaCrawlProfile.java b/source/de/anomic/plasma/plasmaCrawlProfile.java
index ae703017f..d0fa45f3a 100644
--- a/source/de/anomic/plasma/plasmaCrawlProfile.java
+++ b/source/de/anomic/plasma/plasmaCrawlProfile.java
@@ -75,7 +75,7 @@ public class plasmaCrawlProfile {
private void resetDatabase() {
// deletes the profile database and creates a new one
- if (profileTable != null) try { profileTable.close(); } catch (IOException e) {}
+ if (profileTable != null) profileTable.close();
if (!(profileTableFile.delete())) throw new RuntimeException("cannot delete crawl profile database");
profileTableFile.getParentFile().mkdirs();
kelondroDyn dyn = kelondroDyn.open(profileTableFile, true, true, preloadTime, crawlProfileHandleLength, 2000, '#', true, false);
@@ -83,9 +83,7 @@ public class plasmaCrawlProfile {
}
public void close() {
- try {
- profileTable.close();
- } catch (IOException e) {}
+ profileTable.close();
}
public int size() {
diff --git a/source/de/anomic/plasma/plasmaCrawlRobotsTxt.java b/source/de/anomic/plasma/plasmaCrawlRobotsTxt.java
index 54cd5a8a4..740a729de 100644
--- a/source/de/anomic/plasma/plasmaCrawlRobotsTxt.java
+++ b/source/de/anomic/plasma/plasmaCrawlRobotsTxt.java
@@ -76,18 +76,14 @@ public class plasmaCrawlRobotsTxt {
private void resetDatabase() {
// deletes the robots.txt database and creates a new one
- if (robotsTable != null) try {
- robotsTable.close();
- } catch (IOException e) {}
+ if (robotsTable != null) robotsTable.close();
if (!(robotsTableFile.delete())) throw new RuntimeException("cannot delete robots.txt database");
robotsTableFile.getParentFile().mkdirs();
robotsTable = new kelondroMapObjects(kelondroDyn.open(robotsTableFile, true, true, preloadTime, 256, 512, '_', true, false), 100);
}
public void close() {
- try {
- robotsTable.close();
- } catch (IOException e) {}
+ robotsTable.close();
}
public int size() {
diff --git a/source/de/anomic/plasma/plasmaHTCache.java b/source/de/anomic/plasma/plasmaHTCache.java
index 4aec520a4..0d314c6ab 100644
--- a/source/de/anomic/plasma/plasmaHTCache.java
+++ b/source/de/anomic/plasma/plasmaHTCache.java
@@ -188,7 +188,7 @@ public final class plasmaHTCache {
}
private void resetResponseHeaderDB() {
- if (this.responseHeaderDB != null) try {this.responseHeaderDB.close();} catch (IOException e) {}
+ if (this.responseHeaderDB != null) this.responseHeaderDB.close();
File dbfile = new File(this.cachePath, "responseHeader.db");
if (dbfile.exists()) dbfile.delete();
openResponseHeaderDB(0);
@@ -397,7 +397,7 @@ public final class plasmaHTCache {
}
// closing DB
- try {this.responseHeaderDB.close();} catch (IOException e) {}
+ this.responseHeaderDB.close();
}
private String ageString(long date, File f) {
diff --git a/source/de/anomic/plasma/plasmaSwitchboard.java b/source/de/anomic/plasma/plasmaSwitchboard.java
index 905cdea50..c098c4bbf 100644
--- a/source/de/anomic/plasma/plasmaSwitchboard.java
+++ b/source/de/anomic/plasma/plasmaSwitchboard.java
@@ -1576,7 +1576,7 @@ public final class plasmaSwitchboard extends serverAbstractSwitch implements ser
userDB.close();
bookmarksDB.close();
messageDB.close();
- if (facilityDB != null) try {facilityDB.close();} catch (IOException e) {}
+ if (facilityDB != null) facilityDB.close();
sbStackCrawlThread.close();
profiles.close();
robots.close();
@@ -1588,6 +1588,7 @@ public final class plasmaSwitchboard extends serverAbstractSwitch implements ser
noticeURL.close();
errorURL.close();
wordIndex.close();
+ yc.close();
log.logConfig("SWITCHBOARD SHUTDOWN TERMINATED");
}
@@ -3160,7 +3161,7 @@ class delayedShutdown extends Thread {
try {
Thread.sleep(delay);
} catch (InterruptedException e) {
- e.printStackTrace();
+ sb.getLog().logInfo("interrupted delayed shutdown");
}
this.sb.terminate();
}
diff --git a/source/de/anomic/plasma/plasmaSwitchboardQueue.java b/source/de/anomic/plasma/plasmaSwitchboardQueue.java
index a909c8931..9645fa9d8 100644
--- a/source/de/anomic/plasma/plasmaSwitchboardQueue.java
+++ b/source/de/anomic/plasma/plasmaSwitchboardQueue.java
@@ -161,9 +161,8 @@ public class plasmaSwitchboardQueue {
}
public void close() {
- if (sbQueueStack != null) try {
+ if (sbQueueStack != null) {
sbQueueStack.close();
- } catch (IOException e) {
}
sbQueueStack = null;
}
diff --git a/source/de/anomic/plasma/plasmaWordIndex.java b/source/de/anomic/plasma/plasmaWordIndex.java
index 6e9df976d..7327af08f 100644
--- a/source/de/anomic/plasma/plasmaWordIndex.java
+++ b/source/de/anomic/plasma/plasmaWordIndex.java
@@ -383,6 +383,7 @@ public final class plasmaWordIndex implements indexRI {
dhtInCache.close();
dhtOutCache.close();
collections.close();
+ loadedURL.close();
}
}
diff --git a/source/de/anomic/plasma/plasmaWordIndexAssortment.java b/source/de/anomic/plasma/plasmaWordIndexAssortment.java
index 78ac109c9..793eb0191 100644
--- a/source/de/anomic/plasma/plasmaWordIndexAssortment.java
+++ b/source/de/anomic/plasma/plasmaWordIndexAssortment.java
@@ -53,7 +53,6 @@
package de.anomic.plasma;
import java.io.File;
-import java.io.IOException;
import java.util.Iterator;
import de.anomic.index.indexContainer;
@@ -168,11 +167,7 @@ public final class plasmaWordIndexAssortment {
}
public void close() {
- try {
- assortment.close();
- } catch (IOException e){
- log.logSevere("unable to close assortment database: " + e.getMessage(), e);
- }
+ assortment.close();
}
}
diff --git a/source/de/anomic/plasma/plasmaWordIndexFile.java b/source/de/anomic/plasma/plasmaWordIndexFile.java
index 1f81d5ca8..65637232b 100644
--- a/source/de/anomic/plasma/plasmaWordIndexFile.java
+++ b/source/de/anomic/plasma/plasmaWordIndexFile.java
@@ -148,7 +148,7 @@ public final class plasmaWordIndexFile {
public boolean deleteComplete() {
if (theIndex == null) return false;
- try { theIndex.close(); } catch (IOException e) {}
+ theIndex.close();
// remove file
boolean success = theLocation.delete();
// and also the paren directory if that is empty
diff --git a/source/de/anomic/yacy/yacyCore.java b/source/de/anomic/yacy/yacyCore.java
index e788142a8..6af76166d 100644
--- a/source/de/anomic/yacy/yacyCore.java
+++ b/source/de/anomic/yacy/yacyCore.java
@@ -249,6 +249,11 @@ public class yacyCore {
}
}
+ public synchronized void close() {
+ seedDB.close();
+ newsPool.close();
+ }
+
synchronized static public void triggerOnlineAction() {
lastOnlineTime = System.currentTimeMillis();
}
diff --git a/source/de/anomic/yacy/yacyNewsDB.java b/source/de/anomic/yacy/yacyNewsDB.java
index d3356116c..8d10f74f1 100644
--- a/source/de/anomic/yacy/yacyNewsDB.java
+++ b/source/de/anomic/yacy/yacyNewsDB.java
@@ -77,7 +77,7 @@ public class yacyNewsDB {
}
public void close() {
- if (news != null) try {news.close();} catch (IOException e) {}
+ if (news != null) news.close();
news = null;
}
diff --git a/source/de/anomic/yacy/yacyNewsPool.java b/source/de/anomic/yacy/yacyNewsPool.java
index abce9b5fa..4a724cfac 100644
--- a/source/de/anomic/yacy/yacyNewsPool.java
+++ b/source/de/anomic/yacy/yacyNewsPool.java
@@ -100,6 +100,14 @@ public class yacyNewsPool {
maxDistribution = 30;
}
+ public synchronized void close() {
+ newsDB.close();
+ outgoingNews.close();
+ publishedNews.close();
+ incomingNews.close();
+ processedNews.close();
+ }
+
public int dbSize() {
try {
return newsDB.size();
diff --git a/source/de/anomic/yacy/yacyNewsQueue.java b/source/de/anomic/yacy/yacyNewsQueue.java
index 5dd2ef969..a46116bd3 100644
--- a/source/de/anomic/yacy/yacyNewsQueue.java
+++ b/source/de/anomic/yacy/yacyNewsQueue.java
@@ -83,7 +83,7 @@ public class yacyNewsQueue {
}
public void close() {
- if (queueStack != null) try {queueStack.close();} catch (IOException e) {}
+ if (queueStack != null) queueStack.close();
queueStack = null;
}
diff --git a/source/de/anomic/yacy/yacySeedDB.java b/source/de/anomic/yacy/yacySeedDB.java
index 4215c3ba5..8de49ff35 100644
--- a/source/de/anomic/yacy/yacySeedDB.java
+++ b/source/de/anomic/yacy/yacySeedDB.java
@@ -204,14 +204,10 @@ public final class yacySeedDB {
// this is an emergency function that should only be used if any problem with the
// seed.db is detected
yacyCore.log.logFine("seed-db " + seedDBFile.toString() + " reset (on-the-fly)");
- try {
- seedDB.close();
- seedDBFile.delete();
- // create new seed database
- seedDB = openSeedTable(seedDBFile);
- } catch (IOException e) {
- yacyCore.log.logFine("resetSeedTable", e);
- }
+ seedDB.close();
+ seedDBFile.delete();
+ // create new seed database
+ seedDB = openSeedTable(seedDBFile);
return seedDB;
}
@@ -220,12 +216,9 @@ public final class yacySeedDB {
public synchronized void resetPotentialTable() { seedPotentialDB = resetSeedTable(seedPotentialDB, seedPotentialDBFile); }
public void close() {
- try {
- seedActiveDB.close();
- seedPassiveDB.close();
- } catch (IOException e) {
- yacyCore.log.logFine("close", e);
- }
+ if (seedActiveDB != null) seedActiveDB.close();
+ if (seedPassiveDB != null) seedPassiveDB.close();
+ if (seedPotentialDB != null) seedPotentialDB.close();
}
public void initializeHandler(String mapname, Map map) {
diff --git a/source/yacy.java b/source/yacy.java
index c3cc8ee88..4b9887c6e 100644
--- a/source/yacy.java
+++ b/source/yacy.java
@@ -1214,7 +1214,7 @@ public final class yacy {
}
}
sb.close();
- try { oldindex.close(); } catch (IOException e) { }
+ oldindex.close();
System.out.println("MIGRATION OF " + c + " URLs FINISHED");
}
@@ -1234,15 +1234,10 @@ public final class yacy {
private static void urldbcleanup(String homePath) {
File root = new File(homePath);
File indexroot = new File(root, "DATA/INDEX");
- serverLog log = new serverLog("URLDBCLEANUP");
try {serverLog.configureLogging(new File(homePath, "DATA/LOG/yacy.logging"));} catch (Exception e) {}
- try {
- plasmaCrawlLURL currentUrlDB = new plasmaCrawlLURL(indexroot, 10000);
- currentUrlDB.urldbcleanup();
- currentUrlDB.close();
- } catch (IOException e) {
- log.logSevere("IOException", e);
- }
+ plasmaCrawlLURL currentUrlDB = new plasmaCrawlLURL(indexroot, 10000);
+ currentUrlDB.urldbcleanup();
+ currentUrlDB.close();
}
private static void RWIHashList(String homePath, String targetName, String resource, String format) {