]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.db.impl/src/org/simantics/db/impl/MemWatch.java
Fail safe import fixes made by Antti
[simantics/platform.git] / bundles / org.simantics.db.impl / src / org / simantics / db / impl / MemWatch.java
index 2683e7f46d9b81f28bfbe277e169c9b999833f32..aaaed12eb813a828c803cd3d3513d5bed93d7520 100644 (file)
@@ -1,34 +1,34 @@
-package org.simantics.db.impl;\r
-\r
-import java.lang.ref.WeakReference;\r
-\r
-public class MemWatch {\r
-    public static boolean isLowOnMemory() {\r
-        return isLowOnMemory;\r
-    }\r
-    private static boolean DBBUG = false;\r
-    private static boolean isLowOnMemory = false;\r
-    @SuppressWarnings("unused")\r
-    private static MemWatch memWatch = new MemWatch();\r
-    private Runtime runtime = Runtime.getRuntime();\r
-    @SuppressWarnings("unused")\r
-    private WeakReference<Watch> ref = new WeakReference<Watch>(new Watch());\r
-    class Watch {\r
-        @Override\r
-        protected void finalize() throws Throwable {\r
-            long fre = runtime.freeMemory();\r
-            long tot = runtime.totalMemory();\r
-            long max = runtime.maxMemory();\r
-            if (tot < max || fre > max / 20) \r
-                isLowOnMemory = false;\r
-            else\r
-                isLowOnMemory = true;\r
-            if (DBBUG)\r
-              System.err.println("Garbage was collected using " + Thread.currentThread().getName()\r
-              + " fre=" + fre + " tot=" + tot + " max=" + max\r
-              + " low=" + isLowOnMemory);\r
-            ref = new WeakReference<Watch>(new Watch());\r
-            super.finalize();\r
-        }\r
-    }\r
-}\r
+package org.simantics.db.impl;
+
+import java.lang.ref.WeakReference;
+
+public class MemWatch {
+    public static boolean isLowOnMemory() {
+        return isLowOnMemory;
+    }
+    private static boolean DBBUG = false;
+    private static boolean isLowOnMemory = false;
+    @SuppressWarnings("unused")
+    private static MemWatch memWatch = new MemWatch();
+    private Runtime runtime = Runtime.getRuntime();
+    @SuppressWarnings("unused")
+    private WeakReference<Watch> ref = new WeakReference<Watch>(new Watch());
+    class Watch {
+        @Override
+        protected void finalize() throws Throwable {
+            long fre = runtime.freeMemory();
+            long tot = runtime.totalMemory();
+            long max = runtime.maxMemory();
+            if (tot < max || fre > max / 20) 
+                isLowOnMemory = false;
+            else
+                isLowOnMemory = true;
+            if (DBBUG)
+              System.err.println("Garbage was collected using " + Thread.currentThread().getName()
+              + " fre=" + fre + " tot=" + tot + " max=" + max
+              + " low=" + isLowOnMemory);
+            ref = new WeakReference<Watch>(new Watch());
+            super.finalize();
+        }
+    }
+}