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
// 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
try {\r
Thread.sleep(ms);\r
} catch (InterruptedException e) {\r
- Logger.defaultLogError(e);\r
+ LOGGER.warn("Sleep was interrupted.", e);\r
}\r
}\r
\r