]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.modeling/src/org/simantics/modeling/SCL.java
Merge commit 'ffdf837'
[simantics/platform.git] / bundles / org.simantics.modeling / src / org / simantics / modeling / SCL.java
index 555401327c89b48c4bd7cb73355f35a611710796..24e50c0f7606c2cdde27fefdb0fb8a20a2d32d65 100644 (file)
@@ -10,22 +10,25 @@ import org.eclipse.core.runtime.Platform;
 import org.eclipse.core.runtime.jobs.IJobManager;\r
 import org.eclipse.core.runtime.jobs.Job;\r
 import org.simantics.DatabaseJob;\r
-import org.simantics.Logger;\r
 import org.simantics.Simantics;\r
 import org.simantics.SimanticsPlatform;\r
 import org.simantics.SimanticsPlatform.OntologyRecoveryPolicy;\r
 import org.simantics.db.ReadGraph;\r
 import org.simantics.db.Resource;\r
 import org.simantics.db.WriteGraph;\r
-import org.simantics.db.common.request.ReadRequest;\r
 import org.simantics.db.common.request.WriteRequest;\r
 import org.simantics.db.exception.DatabaseException;\r
 import org.simantics.db.layer0.request.external.EclipsePreferencePrimitiveRead;\r
 import org.simantics.db.layer0.util.RemoverUtil;\r
 import org.simantics.db.layer0.util.SimanticsClipboard;\r
 import org.simantics.db.service.DebugSupport;\r
+import org.simantics.db.service.ServiceActivityMonitor;\r
+import org.slf4j.Logger;\r
+import org.slf4j.LoggerFactory;\r
 \r
 public class SCL {\r
+    private static final Logger LOGGER = LoggerFactory.getLogger(SCL.class);\r
+\r
     public static void killPlatformWrite(WriteGraph graph) throws DatabaseException {\r
         // Currently not supported.\r
         // Would be relatively easy to support the desired functionality.\r
@@ -61,29 +64,33 @@ public class SCL {
        //  but unfortunately this does not work either...\r
        // so we synchronize by a familiar write transaction\r
         // And then wait still some more\r
-               for(int i=0;i<3;i++) {\r
-              Simantics.getSession().syncRequest(new WriteRequest() {\r
-                   @Override\r
-                   public void perform(WriteGraph graph) throws DatabaseException {\r
-                   }\r
-\r
-                       @Override\r
-                       public String toString() {\r
-                               return "Utils sync";\r
-                       }\r
-              });\r
-\r
-              // And then wait still some more\r
-              Simantics.getSession().syncRequest(new ReadRequest() {\r
-                  @Override\r
-                  public void run(ReadGraph graph) throws DatabaseException {\r
-                  }\r
-             });\r
-               }\r
+//             for(int i=0;i<3;i++) {\r
+       Simantics.getSession().syncRequest(new WriteRequest() {\r
+            @Override\r
+            public void perform(WriteGraph graph) throws DatabaseException {\r
+            }\r
+\r
+               @Override\r
+               public String toString() {\r
+                       return "Utils sync";\r
+               }\r
+       });\r
+//\r
+//            // And then wait still some more\r
+//            Simantics.getSession().syncRequest(new ReadRequest() {\r
+//                @Override\r
+//                public void run(ReadGraph graph) throws DatabaseException {\r
+//                }\r
+//           });\r
+//             }\r
     }\r
 \r
     public static void syncGraph() throws Exception {\r
-        sync();\r
+        try {\r
+            Simantics.getSession().getService(ServiceActivityMonitor.class).waitForCompletion();\r
+        } catch (InterruptedException e) {\r
+            throw new DatabaseException(e);\r
+        }\r
 \r
                // OK, now the experiment activate job should be scheduled\r
                // Wait for the job to finish\r
@@ -109,7 +116,7 @@ public class SCL {
        try {\r
                        Thread.sleep(ms);\r
                } catch (InterruptedException e) {\r
-                       Logger.defaultLogError(e);\r
+            LOGGER.warn("Sleep was interrupted.", e);\r
                }\r
     }\r
 \r