Mark Lucene Index Creator threads daemons 15/1115/2
authorTuukka Lehtonen <tuukka.lehtonen@semantum.fi>
Mon, 16 Oct 2017 20:07:53 +0000 (23:07 +0300)
committerTuukka Lehtonen <tuukka.lehtonen@semantum.fi>
Mon, 16 Oct 2017 20:23:37 +0000 (23:23 +0300)
Also protect against a potential NPE in
IndexedRelationsSearcherBase.initializeIndexImpl.

refs #7553

Change-Id: I516eecfa758b532b824693e9c6a2449a18a65a69

bundles/org.simantics.db.indexing/src/org/simantics/db/indexing/IndexedRelationsSearcherBase.java

index 92cbe56d12bacfa76d30696811d90a01cfe4f00f..1c0b9b8416769db88afadb86d5350a62e98d0606 100644 (file)
@@ -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));
             }
         }
     }