]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.db/src/org/simantics/db/Disposable.java
Dispose ClientChangesImpl ChangeSets to minimize memory footprint
[simantics/platform.git] / bundles / org.simantics.db / src / org / simantics / db / Disposable.java
index 9da08dd86c980a3c13ad7547bb56697edc8c68ea..a413837fd3ed4310d32f57b78c39dd6d550f0ea6 100644 (file)
@@ -27,4 +27,14 @@ public interface Disposable {
 
     void dispose();
 
+    static void safeDispose(Disposable d) {
+        if (d != null)
+            d.dispose();
+    }
+
+    static void safeDispose(Object o) {
+        if (o instanceof Disposable)
+            ((Disposable) o).dispose();
+    }
+
 }