X-Git-Url: https://gerrit.simantics.org/r/gitweb?p=simantics%2Fplatform.git;a=blobdiff_plain;f=bundles%2Forg.simantics.modeling%2Fsrc%2Forg%2Fsimantics%2Fmodeling%2FSCL.java;h=24e50c0f7606c2cdde27fefdb0fb8a20a2d32d65;hp=555401327c89b48c4bd7cb73355f35a611710796;hb=5930811a7911090a0c4984380c3b45ed81a93cde;hpb=abe6893036ad75927f61cfd542562d62ef3c5edc diff --git a/bundles/org.simantics.modeling/src/org/simantics/modeling/SCL.java b/bundles/org.simantics.modeling/src/org/simantics/modeling/SCL.java index 555401327..24e50c0f7 100644 --- a/bundles/org.simantics.modeling/src/org/simantics/modeling/SCL.java +++ b/bundles/org.simantics.modeling/src/org/simantics/modeling/SCL.java @@ -10,22 +10,25 @@ import org.eclipse.core.runtime.Platform; import org.eclipse.core.runtime.jobs.IJobManager; import org.eclipse.core.runtime.jobs.Job; import org.simantics.DatabaseJob; -import org.simantics.Logger; import org.simantics.Simantics; import org.simantics.SimanticsPlatform; import org.simantics.SimanticsPlatform.OntologyRecoveryPolicy; import org.simantics.db.ReadGraph; import org.simantics.db.Resource; import org.simantics.db.WriteGraph; -import org.simantics.db.common.request.ReadRequest; import org.simantics.db.common.request.WriteRequest; import org.simantics.db.exception.DatabaseException; import org.simantics.db.layer0.request.external.EclipsePreferencePrimitiveRead; import org.simantics.db.layer0.util.RemoverUtil; import org.simantics.db.layer0.util.SimanticsClipboard; import org.simantics.db.service.DebugSupport; +import org.simantics.db.service.ServiceActivityMonitor; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; public class SCL { + private static final Logger LOGGER = LoggerFactory.getLogger(SCL.class); + public static void killPlatformWrite(WriteGraph graph) throws DatabaseException { // Currently not supported. // Would be relatively easy to support the desired functionality. @@ -61,29 +64,33 @@ public class SCL { // but unfortunately this does not work either... // so we synchronize by a familiar write transaction // And then wait still some more - for(int i=0;i<3;i++) { - Simantics.getSession().syncRequest(new WriteRequest() { - @Override - public void perform(WriteGraph graph) throws DatabaseException { - } - - @Override - public String toString() { - return "Utils sync"; - } - }); - - // And then wait still some more - Simantics.getSession().syncRequest(new ReadRequest() { - @Override - public void run(ReadGraph graph) throws DatabaseException { - } - }); - } +// for(int i=0;i<3;i++) { + Simantics.getSession().syncRequest(new WriteRequest() { + @Override + public void perform(WriteGraph graph) throws DatabaseException { + } + + @Override + public String toString() { + return "Utils sync"; + } + }); +// +// // And then wait still some more +// Simantics.getSession().syncRequest(new ReadRequest() { +// @Override +// public void run(ReadGraph graph) throws DatabaseException { +// } +// }); +// } } public static void syncGraph() throws Exception { - sync(); + try { + Simantics.getSession().getService(ServiceActivityMonitor.class).waitForCompletion(); + } catch (InterruptedException e) { + throw new DatabaseException(e); + } // OK, now the experiment activate job should be scheduled // Wait for the job to finish @@ -109,7 +116,7 @@ public class SCL { try { Thread.sleep(ms); } catch (InterruptedException e) { - Logger.defaultLogError(e); + LOGGER.warn("Sleep was interrupted.", e); } }