diff --git a/source/net/yacy/crawler/CrawlStacker.java b/source/net/yacy/crawler/CrawlStacker.java index 3c5c7174e..16ffea78b 100644 --- a/source/net/yacy/crawler/CrawlStacker.java +++ b/source/net/yacy/crawler/CrawlStacker.java @@ -124,6 +124,12 @@ public final class CrawlStacker implements WorkflowTask{ public synchronized void close() { CrawlStacker.log.info("Shutdown. waiting for remaining " + this.size() + " crawl stacker job entries. please wait."); this.requestQueue.shutdown(); + + // busy waiting for the queue to empty + for (int i = 0; i < 10; i++) { + if (this.size() <= 0) break; + try {Thread.sleep(1000);} catch (InterruptedException e) {} + } CrawlStacker.log.info("Shutdown. Closing stackCrawl queue."); diff --git a/source/net/yacy/search/index/Fulltext.java b/source/net/yacy/search/index/Fulltext.java index e9e89bd01..43fe1d740 100644 --- a/source/net/yacy/search/index/Fulltext.java +++ b/source/net/yacy/search/index/Fulltext.java @@ -366,7 +366,7 @@ public final class Fulltext { public void putDocument(final SolrInputDocument doc) throws IOException { final SolrConnector connector = this.getDefaultConnector(); - if (connector == null) return; + if (connector == null || connector.isClosed()) return; final String id = (String) doc.getFieldValue(CollectionSchema.id.getSolrFieldName()); final String url = (String) doc.getFieldValue(CollectionSchema.sku.getSolrFieldName()); assert url != null && url.length() < 30000; diff --git a/source/net/yacy/yacy.java b/source/net/yacy/yacy.java index c4ca1838d..d43179c0f 100644 --- a/source/net/yacy/yacy.java +++ b/source/net/yacy/yacy.java @@ -406,8 +406,8 @@ public final class yacy { ConcurrentLog.severe("STARTUP", "Unexpected Error: " + e.getClass().getName(),e); //System.exit(1); } - if(lock != null) lock.release(); - if(channel != null) channel.close(); + if (lock != null && lock.isValid()) lock.release(); + if (channel != null && channel.isOpen()) channel.close(); } catch (final Exception ee) { ConcurrentLog.severe("STARTUP", "FATAL ERROR: " + ee.getMessage(),ee); } finally {