]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.acorn/src/org/simantics/acorn/ClusterManager.java
Make Write-interfaces as @FunctionalInterface for lambdas
[simantics/platform.git] / bundles / org.simantics.acorn / src / org / simantics / acorn / ClusterManager.java
index b2a30953cca9e0bff26e72dc69a788139e52a817..22629d4e64237ab63c6fc89a12f0754087254edb 100644 (file)
@@ -35,8 +35,12 @@ import org.simantics.db.service.ClusterSetsSupport;
 import org.simantics.db.service.ClusterUID;
 import org.simantics.utils.threads.logger.ITask;
 import org.simantics.utils.threads.logger.ThreadLogger;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 public class ClusterManager {
+    
+    final static Logger LOGGER = LoggerFactory.getLogger(ClusterManager.class); 
 
        private ArrayList<String> currentChanges = new ArrayList<String>();
 
@@ -143,12 +147,12 @@ public class ClusterManager {
                // Cluster files are always there 
                // Nothing has been written => no need to do anything
                long amountOfFiles = countFiles(workingDirectory);
-               if(!fullSave && amountOfFiles < 3) {
+               if(!fullSave && amountOfFiles == 0) {
     //             System.err.println("amountOfFiles < 3");
                    return false;
                }
     
-               System.err.println("makeSnapshot");
+               LOGGER.info("makeSnapshot");
     
                // Schedule writing of all data to disk
             refreshHeadState();
@@ -163,17 +167,17 @@ public class ClusterManager {
                if (!safeToMakeSnapshot.get())
                    throw cause;
                
+               ClusterSetsSupport cssi = locator.getService(ClusterSetsSupport.class); 
+               cssi.save();
+
                persistHeadState();
-               
+
                if (fullSave)
                    mainState.save(dbFolder);
     
-               ClusterSetsSupport cssi = locator.getService(ClusterSetsSupport.class); 
-               cssi.save();
-    
                amountOfFiles = countFiles(workingDirectory);
                
-               System.err.println(" -finished: amount of files is " + amountOfFiles);
+               LOGGER.info(" -finished: amount of files is {}", amountOfFiles);
     
                workingDirectory = dbFolder.resolve(Integer.toString(mainState.headDir));
                if (!Files.exists(workingDirectory)) {