From: Tuukka Lehtonen Date: Mon, 16 Oct 2017 20:07:53 +0000 (+0300) Subject: Mark Lucene Index Creator threads daemons X-Git-Tag: v1.31.0~116 X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=commitdiff_plain;h=53733aee4b4a9cdc333e722700867a3e700544b9;p=simantics%2Fplatform.git Mark Lucene Index Creator threads daemons Also protect against a potential NPE in IndexedRelationsSearcherBase.initializeIndexImpl. refs #7553 Change-Id: I516eecfa758b532b824693e9c6a2449a18a65a69 --- diff --git a/bundles/org.simantics.db.indexing/src/org/simantics/db/indexing/IndexedRelationsSearcherBase.java b/bundles/org.simantics.db.indexing/src/org/simantics/db/indexing/IndexedRelationsSearcherBase.java index 92cbe56d1..1c0b9b841 100644 --- a/bundles/org.simantics.db.indexing/src/org/simantics/db/indexing/IndexedRelationsSearcherBase.java +++ b/bundles/org.simantics.db.indexing/src/org/simantics/db/indexing/IndexedRelationsSearcherBase.java @@ -577,7 +577,7 @@ abstract public class IndexedRelationsSearcherBase { @Override public Thread newThread(Runnable r) { Thread t = new Thread(r, "Lucene Index Creator"); - if (t.isDaemon()) + if (!t.isDaemon()) t.setDaemon(true); if (t.getPriority() != Thread.NORM_PRIORITY) t.setPriority(Thread.NORM_PRIORITY); @@ -708,7 +708,7 @@ abstract public class IndexedRelationsSearcherBase { try { closeWriter(writer.getAndSet(null)); } finally { - directory.getAndSet(null).close(); + FileUtils.uncheckedClose(directory.getAndSet(null)); } } }