]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.db.common/src/org/simantics/db/common/QueryMemoryWatcher.java
Fixed all line endings of the repository
[simantics/platform.git] / bundles / org.simantics.db.common / src / org / simantics / db / common / QueryMemoryWatcher.java
index 178177a1f2bdfb348c15c999b6e45afe185e4821..23e5982316549942d68e32646259d594177942c3 100644 (file)
@@ -1,46 +1,46 @@
-package org.simantics.db.common;\r
-\r
-import org.simantics.db.ReadGraph;\r
-import org.simantics.db.service.QueryControl;\r
-\r
-public class QueryMemoryWatcher {\r
-\r
-    final ReadGraph graph;\r
-    final QueryControl support;\r
-    final int stopTime;\r
-    final long baseline;\r
-    final long highLimit;\r
-    final long lowLimit;\r
-    boolean collecting = false;\r
-    \r
-    public QueryMemoryWatcher(ReadGraph graph, int allowedQueries) {\r
-        this(graph, allowedQueries, 0.5, 10);\r
-    }\r
-\r
-    public QueryMemoryWatcher(ReadGraph graph, int allowedQueries, double ratio, int stopTime) {\r
-        this.support = graph.getService(QueryControl.class);\r
-        baseline = support.count();\r
-        highLimit = baseline + allowedQueries;\r
-        lowLimit = baseline + (int)(allowedQueries*ratio);\r
-        this.graph = graph;\r
-        this.stopTime = 10;\r
-        //System.err.println("QueryMemoryWatcher started with " + baseline + " queries.");\r
-    }\r
-    \r
-    public void maintain() {\r
-        long current = support.count();\r
-        if(collecting) {\r
-            if(current > lowLimit) support.gc(graph, stopTime);\r
-            else {\r
-//                System.err.println("QueryMemoryWatcher stops collecting");\r
-                collecting = false;\r
-            }\r
-        } else {\r
-            if(current > highLimit) {\r
-//                System.err.println("QueryMemoryWatcher starts collecting");\r
-                collecting = true;\r
-            }\r
-        }\r
-    }\r
-    \r
-}\r
+package org.simantics.db.common;
+
+import org.simantics.db.ReadGraph;
+import org.simantics.db.service.QueryControl;
+
+public class QueryMemoryWatcher {
+
+    final ReadGraph graph;
+    final QueryControl support;
+    final int stopTime;
+    final long baseline;
+    final long highLimit;
+    final long lowLimit;
+    boolean collecting = false;
+    
+    public QueryMemoryWatcher(ReadGraph graph, int allowedQueries) {
+        this(graph, allowedQueries, 0.5, 10);
+    }
+
+    public QueryMemoryWatcher(ReadGraph graph, int allowedQueries, double ratio, int stopTime) {
+        this.support = graph.getService(QueryControl.class);
+        baseline = support.count();
+        highLimit = baseline + allowedQueries;
+        lowLimit = baseline + (int)(allowedQueries*ratio);
+        this.graph = graph;
+        this.stopTime = 10;
+        //System.err.println("QueryMemoryWatcher started with " + baseline + " queries.");
+    }
+    
+    public void maintain() {
+        long current = support.count();
+        if(collecting) {
+            if(current > lowLimit) support.gc(graph, stopTime);
+            else {
+//                System.err.println("QueryMemoryWatcher stops collecting");
+                collecting = false;
+            }
+        } else {
+            if(current > highLimit) {
+//                System.err.println("QueryMemoryWatcher starts collecting");
+                collecting = true;
+            }
+        }
+    }
+    
+}