From: Tuukka Lehtonen Date: Fri, 27 Oct 2017 12:58:26 +0000 (+0300) Subject: New graphSessionGarbageCollector.gc method with progress mon + ReadGraph X-Git-Tag: v1.31.0~92 X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=commitdiff_plain;h=44984b07d8a3827c0feee4ef3bc9e953e7b4607c;p=simantics%2Fplatform.git New graphSessionGarbageCollector.gc method with progress mon + ReadGraph refs #7579 Change-Id: Id550fa67c90d1cf02d7b5f3e707b5e770dce9eae --- diff --git a/bundles/org.simantics.db.layer0/src/org/simantics/db/layer0/util/SessionGarbageCollection.java b/bundles/org.simantics.db.layer0/src/org/simantics/db/layer0/util/SessionGarbageCollection.java index 3fceebea2..26e049db6 100644 --- a/bundles/org.simantics.db.layer0/src/org/simantics/db/layer0/util/SessionGarbageCollection.java +++ b/bundles/org.simantics.db.layer0/src/org/simantics/db/layer0/util/SessionGarbageCollection.java @@ -63,13 +63,17 @@ public class SessionGarbageCollection { long took = gc(monitor, session, sync, errorCallback, DEFAULT_ALLOWED_TIME, DEFAULT_CLUSTER_TARGET); return ((16*took) / DEFAULT_ALLOWED_TIME) > 15; } - + public static void gc(ReadGraph graph, final int allowedTimeInMs, final int clusterTarget) throws DatabaseException { - doIt(null, graph, allowedTimeInMs, clusterTarget); + doIt(null, graph, allowedTimeInMs, clusterTarget); + } + + public static void gc(IProgressMonitor monitor, ReadGraph graph, final int allowedTimeInMs, final int clusterTarget) throws DatabaseException { + doIt(monitor, graph, allowedTimeInMs, clusterTarget); } private static void doIt(IProgressMonitor _monitor, ReadGraph graph, final int allowedTimeInMs, final int clusterTarget) { - if(_monitor == null) _monitor = new NullProgressMonitor(); + if(_monitor == null) _monitor = new NullProgressMonitor(); QueryControl qc = graph.getService(QueryControl.class); ClusterControl cc = graph.getService(ClusterControl.class); _monitor.beginTask("Collect clusters", IProgressMonitor.UNKNOWN); @@ -77,7 +81,7 @@ public class SessionGarbageCollection { _monitor.beginTask("Collect queries", IProgressMonitor.UNKNOWN); qc.gc(graph, allowedTimeInMs); } - + /** * @param monitor * @param session