From 53733aee4b4a9cdc333e722700867a3e700544b9 Mon Sep 17 00:00:00 2001 From: Tuukka Lehtonen Date: Mon, 16 Oct 2017 23:07:53 +0300 Subject: [PATCH] Mark Lucene Index Creator threads daemons Also protect against a potential NPE in IndexedRelationsSearcherBase.initializeIndexImpl. refs #7553 Change-Id: I516eecfa758b532b824693e9c6a2449a18a65a69 --- .../simantics/db/indexing/IndexedRelationsSearcherBase.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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)); } } } -- 2.47.1