]> gerrit.simantics Code Review - simantics/platform.git/commitdiff
New graphSessionGarbageCollector.gc method with progress mon + ReadGraph 48/1148/1
authorTuukka Lehtonen <tuukka.lehtonen@semantum.fi>
Fri, 27 Oct 2017 12:58:26 +0000 (15:58 +0300)
committerTuukka Lehtonen <tuukka.lehtonen@semantum.fi>
Fri, 27 Oct 2017 12:58:26 +0000 (15:58 +0300)
refs #7579

Change-Id: Id550fa67c90d1cf02d7b5f3e707b5e770dce9eae

bundles/org.simantics.db.layer0/src/org/simantics/db/layer0/util/SessionGarbageCollection.java

index 3fceebea2827b6cdcc7ea0b4a3514f545fc4de8f..26e049db67d5d95c87e47e56d81b9ad843ac4572 100644 (file)
@@ -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