X-Git-Url: https://gerrit.simantics.org/r/gitweb?p=simantics%2Fplatform.git;a=blobdiff_plain;f=bundles%2Forg.simantics.db.indexing%2Fsrc%2Forg%2Fsimantics%2Fdb%2Findexing%2FMemoryIndexing.java;h=75c6b79bb51c6a1dc4da3b9c9e1064f3fbb93b25;hp=60b76100c2db49e6eb7507575359ac47fb5e133e;hb=8b8630b93f8e4ec88a8a4eb53b55031407deedc0;hpb=0242b51bcb69c03ea15aa785abc39ed70c9dbbd7 diff --git a/bundles/org.simantics.db.indexing/src/org/simantics/db/indexing/MemoryIndexing.java b/bundles/org.simantics.db.indexing/src/org/simantics/db/indexing/MemoryIndexing.java index 60b76100c..75c6b79bb 100644 --- a/bundles/org.simantics.db.indexing/src/org/simantics/db/indexing/MemoryIndexing.java +++ b/bundles/org.simantics.db.indexing/src/org/simantics/db/indexing/MemoryIndexing.java @@ -1,7 +1,7 @@ package org.simantics.db.indexing; -import java.io.File; import java.io.IOException; +import java.nio.file.Path; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -20,9 +20,9 @@ import org.simantics.db.RequestProcessor; import org.simantics.db.Resource; import org.simantics.db.Session; import org.simantics.db.common.request.Adapt; -import org.simantics.db.common.utils.Logger; import org.simantics.db.indexing.IndexedRelationsSearcherBase.State; import org.simantics.db.layer0.adapter.GenericRelation; +import org.slf4j.LoggerFactory; /** * @author Tuukka Lehtonen @@ -30,6 +30,8 @@ import org.simantics.db.layer0.adapter.GenericRelation; */ public class MemoryIndexing { + private static final org.slf4j.Logger LOGGER = LoggerFactory.getLogger(MemoryIndexing.class); + final private Session session; final Map>>> persistentCache = new HashMap>>>(); @@ -44,14 +46,14 @@ public class MemoryIndexing { this.session = session; } - protected File getIndexDirectory(Resource relation, Resource input) { + protected Path getIndexDirectory(Resource relation, Resource input) { return DatabaseIndexing.getIndexLocation(session, relation, input); } public IndexedRelationsSearcher get(RequestProcessor processor, Resource relation, Resource input) { + Path location = getIndexDirectory(relation, input); try { - File location = getIndexDirectory(relation, input); - String key = location.getAbsolutePath(); + String key = location.toAbsolutePath().toString(); IndexedRelationsSearcher searcher = searchers.get(key); if (searcher == null) { GenericRelation r = processor.sync(new Adapt(relation, GenericRelation.class)); @@ -60,15 +62,15 @@ public class MemoryIndexing { } return searcher; } catch (Exception e) { - Logger.defaultLogError(e); + LOGGER.error("Could not get searcher for relation {} and input {} in location {}", relation, input, location, e); return null; } } public IndexedRelationsSearcherBase getImmutable(RequestProcessor processor, Resource relation, Resource input) { + Path location = getIndexDirectory(relation, input); try { - File location = getIndexDirectory(relation, input); - String key = location.getAbsolutePath(); + String key = location.toAbsolutePath().toString(); IndexedRelationsSearcherBase searcher = immutableSearchers.get(key); if (searcher == null) { searcher = new ImmutableIndexedRelationsSearcher(processor, relation, input); @@ -76,7 +78,7 @@ public class MemoryIndexing { } return searcher; } catch (Exception e) { - Logger.defaultLogError(e); + LOGGER.error("Could not get searcher base for relation {} and input {} in location {}", relation, input, location, e); return null; } }