Author: j16sdiz
Date: 2008-12-26 10:07:22 +0000 (Fri, 26 Dec 2008)
New Revision: 24794
Modified:
trunk/plugins/XMLSpider/XMLSpider.java
Log:
termination
Modified: trunk/plugins/XMLSpider/XMLSpider.java
===================================================================
--- trunk/plugins/XMLSpider/XMLSpider.java 2008-12-26 10:07:04 UTC (rev
24793)
+++ trunk/plugins/XMLSpider/XMLSpider.java 2008-12-26 10:07:22 UTC (rev
24794)
@@ -449,8 +449,12 @@
page.lastChange = System.currentTimeMillis();
db.store(page);
}
- db.commit();
- startSomeRequests();
+ if (!stopped) {
+ db.commit();
+ startSomeRequests();
+ } else {
+ db.rollback();
+ }
}
}
@@ -510,8 +514,10 @@
runningFetch.clear();
callbackExecutor.shutdownNow();
}
- try { callbackExecutor.awaitTermination(15, TimeUnit.SECONDS);
} catch (InterruptedException e) {}
+ try { callbackExecutor.awaitTermination(30, TimeUnit.SECONDS);
} catch (InterruptedException e) {}
+ try { db.rollback(); } catch (Exception e) {}
try { db.close(); } catch (Exception e) {}
+
synchronized (this) {
termCache.clear();
}
@@ -623,6 +629,7 @@
}
public void foundURI(FreenetURI uri, boolean inline){
+ if (stopped) return;
Logger.debug(this, "foundURI " + uri + " on " + page);
queueURI(uri, "Added from " + page.uri, false);
}
@@ -630,6 +637,8 @@
protected Integer lastPosition = null;
public void onText(String s, String type, URI baseURI){
+ if (stopped) return;
+
Logger.debug(this, "onText on " + page.id + " (" +
baseURI + ")");
if ("title".equalsIgnoreCase(type) && (s != null) &&
(s.length() != 0) && (s.indexOf('\n') < 0)) {
_______________________________________________
cvs mailing list
[email protected]
http://emu.freenetproject.org/cgi-bin/mailman/listinfo/cvs