From: Antti Villberg Date: Fri, 27 Jul 2018 17:01:49 +0000 (+0300) Subject: Yet another fixing commit X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=commitdiff_plain;h=refs%2Fheads%2Fprivate%2Fantti_threads;p=simantics%2Fplatform.git Yet another fixing commit Change-Id: Ie0d47e541b5cc784d94d57acd1242b4be2e387a8 --- diff --git a/bundles/org.simantics.db.impl/src/org/simantics/db/impl/BlockingAsyncProcedure.java b/bundles/org.simantics.db.impl/src/org/simantics/db/impl/BlockingAsyncProcedure.java index b751e8f70..c29e5f992 100644 --- a/bundles/org.simantics.db.impl/src/org/simantics/db/impl/BlockingAsyncProcedure.java +++ b/bundles/org.simantics.db.impl/src/org/simantics/db/impl/BlockingAsyncProcedure.java @@ -22,61 +22,6 @@ import org.simantics.db.impl.graph.ReadGraphImpl; import org.simantics.db.procedure.AsyncProcedure; public class BlockingAsyncProcedure implements AsyncProcedure { -<<<<<<< Upstream, based on branch 'private/antti_threads' of ssh://villberg@gerrit.simantics.org:29418/simantics/platform.git - - final private Object key; - final private ReadGraphImpl graph; - final private AsyncProcedure procedure; - - private Result result = null; - private Throwable exception = null; - - public BlockingAsyncProcedure(ReadGraphImpl graph, AsyncProcedure procedure, Object key) { - this.procedure = procedure; - this.key = key; - this.graph = ReadGraphImpl.newAsync(graph); - this.graph.asyncBarrier.inc(); - } - - @Override - public void execute(AsyncReadGraph graph, Result result) { - this.result = result; - this.graph.asyncBarrier.dec(); - try { - if(procedure != null) procedure.execute(graph, result); - } catch (Throwable throwable) { - Logger.defaultLogError("AsyncProcedure.execute threw for " + procedure, throwable); - } - } - - @Override - public void exception(AsyncReadGraph graph, Throwable t) { - this.exception = t; - try { - if(procedure != null) procedure.exception(graph, t); - } catch (Throwable throwable) { - Logger.defaultLogError("AsyncProcedure.exception threw for " + procedure, throwable); - } finally { - } - this.graph.asyncBarrier.dec(); - } - - public Result get() throws DatabaseException { - - graph.asyncBarrier.waitBarrier(key, graph); - - if(exception != null) { - if(exception instanceof DatabaseException) throw (DatabaseException)exception; - throw new DatabaseException(exception); - } else { - return result; - } - - } - - public Result getResult() { - return result; -======= final private static Object NO_RESULT = new Object(); @@ -132,7 +77,6 @@ public class BlockingAsyncProcedure implements AsyncProcedure { public Result getResult() { return (Result)result; ->>>>>>> 82fa68e Generate parts of db client query code } public Throwable getException() { diff --git a/bundles/org.simantics.db.impl/src/org/simantics/db/impl/query/CodeGen.java b/bundles/org.simantics.db.impl/src/org/simantics/db/impl/query/CodeGen.java index 16af00b30..212326087 100644 --- a/bundles/org.simantics.db.impl/src/org/simantics/db/impl/query/CodeGen.java +++ b/bundles/org.simantics.db.impl/src/org/simantics/db/impl/query/CodeGen.java @@ -25,147 +25,6 @@ public class CodeGen { String[] signatureChildMap = { "int r", "r", "keyR", "long", "InternalProcedure>", "entry.id" }; String[] signatureRead = { "Read r", "r", "id", "long", "AsyncProcedure", "entry.request" }; String[] signatureAsyncRead = { "AsyncRead r", "r", "id", "long", "AsyncProcedure", "entry.request" }; -<<<<<<< Upstream, based on branch 'private/antti_threads' of ssh://villberg@gerrit.simantics.org:29418/simantics/platform.git - String[] signatureMultiRead = { "MultiRead r", "r", "id", "long", "AsyncMultiProcedure", "entry.request" }; - String[] signatureAsyncMultiRead = { "AsyncMultiRead r", "r", "id", "long", "AsyncMultiProcedure", "entry.request" }; - String[] signatureExternalRead = { "ExternalRead r", "r", "id", "long", "AsyncProcedure", "entry.request" }; - - private void line(StringBuilder content, String line) { - for(int i=0;i r", "r", "id", "long", "SyncMultiProcedure", "entry.request" }; String[] signatureAsyncMultiRead = { "AsyncMultiRead r", "r", "id", "long", "AsyncMultiProcedure", "entry.request" }; String[] signatureExternalRead = { "ExternalRead r", "r", "id", "long", "AsyncProcedure", "entry.request" }; @@ -304,7 +163,6 @@ public class CodeGen { content.append("import org.simantics.db.request.ExternalRead;\n"); content.append("import org.simantics.db.request.MultiRead;\n"); content.append("import org.simantics.db.request.Read;\n"); ->>>>>>> 82fa68e Generate parts of db client query code content.append("\n"); content.append("public class QueryCache extends QueryCacheBase {\n"); diff --git a/bundles/org.simantics.db.procore/src/fi/vtt/simantics/procore/internal/SessionImplSocket.java b/bundles/org.simantics.db.procore/src/fi/vtt/simantics/procore/internal/SessionImplSocket.java index 91faecfb7..a3d3c630e 100644 --- a/bundles/org.simantics.db.procore/src/fi/vtt/simantics/procore/internal/SessionImplSocket.java +++ b/bundles/org.simantics.db.procore/src/fi/vtt/simantics/procore/internal/SessionImplSocket.java @@ -1653,29 +1653,11 @@ public abstract class SessionImplSocket implements Session, WriteRequestSchedule request.perform(newGraph, wrap); wrap.get(); -<<<<<<< Upstream, based on branch 'private/antti_threads' of ssh://villberg@gerrit.simantics.org:29418/simantics/platform.git -======= } catch (DatabaseException e) { Logger.defaultLogError(e); -// wrap.exception(newGraph, t); -// wrapper.exception(newGraph, t); -// newGraph.waitAsync(request); ->>>>>>> 82fa68e Generate parts of db client query code - -<<<<<<< Upstream, based on branch 'private/antti_threads' of ssh://villberg@gerrit.simantics.org:29418/simantics/platform.git - } catch (Throwable t) { - - wrap.exception(newGraph, t); - -// wrapper.exception(newGraph, t); -// newGraph.waitAsync(request); - - -======= ->>>>>>> 82fa68e Generate parts of db client query code } } diff --git a/bundles/org.simantics.document.server/META-INF/MANIFEST.MF b/bundles/org.simantics.document.server/META-INF/MANIFEST.MF index d7b561f8f..71eac90b2 100644 --- a/bundles/org.simantics.document.server/META-INF/MANIFEST.MF +++ b/bundles/org.simantics.document.server/META-INF/MANIFEST.MF @@ -24,13 +24,9 @@ Require-Bundle: org.simantics.document.server.io;visibility:=reexport, org.simantics.scl.db;bundle-version="0.1.3", org.slf4j.api, -<<<<<<< Upstream, based on branch 'private/antti_threads' of ssh://villberg@gerrit.simantics.org:29418/simantics/platform.git - org.simantics.threadlog -======= org.simantics.threadlog, org.simantics.simulator.toolkit, org.simantics.simulator.toolkit.db;bundle-version="1.0.0";visibility:=reexport ->>>>>>> 82fa68e Generate parts of db client query code Bundle-ActivationPolicy: lazy Bundle-Activator: org.simantics.document.server.Activator Export-Package: org.simantics.document.server, @@ -38,6 +34,7 @@ Export-Package: org.simantics.document.server, org.simantics.document.server.client, org.simantics.document.server.handler, org.simantics.document.server.request, - org.simantics.document.server.serverResponse + org.simantics.document.server.serverResponse, + org.simantics.document.server.state Import-Package: org.simantics.layer0.utils.direct Bundle-ClassPath: . diff --git a/bundles/org.simantics.document.server/src/org/simantics/document/server/request/DocumentRequest.java b/bundles/org.simantics.document.server/src/org/simantics/document/server/request/DocumentRequest.java index 779cf4fe1..2f4f7eec6 100644 --- a/bundles/org.simantics.document.server/src/org/simantics/document/server/request/DocumentRequest.java +++ b/bundles/org.simantics.document.server/src/org/simantics/document/server/request/DocumentRequest.java @@ -6,12 +6,9 @@ import java.util.Comparator; import java.util.HashSet; import java.util.List; import java.util.Set; -import java.util.concurrent.Semaphore; -import java.util.concurrent.TimeUnit; import org.simantics.db.AsyncReadGraph; import org.simantics.db.ReadGraph; -import org.simantics.db.common.GraphSemaphore; import org.simantics.db.common.procedure.adapter.TransientCacheAsyncListener; import org.simantics.db.common.request.AsyncReadRequest; import org.simantics.db.exception.DatabaseException; @@ -82,44 +79,6 @@ public class DocumentRequest extends VariableRead> { System.out.println(" " + node.getURI(graph)); }*/ -<<<<<<< Upstream, based on branch 'private/antti_threads' of ssh://villberg@gerrit.simantics.org:29418/simantics/platform.git - GraphSemaphore done = new GraphSemaphore(graph, 0); - - for(Variable node : nodes) { - - graph.asyncRequest(new NodeRequestE(node), new Listener() { - - @Override - public void execute(JSONObject result) { - synchronized(rs) { - rs.add(result); - } - done.release(); - } - - @Override - public void exception(Throwable t) { - t.printStackTrace(); - done.release(); - } - - @Override - public boolean isDisposed() { - return true; - } - - }); - -// rs.add(graph.syncRequest(new NodeRequest(node), TransientCacheAsyncListener.instance())); - - } - - try { - done.waitFor(nodes.size()); - } catch (InterruptedException e) { - e.printStackTrace(); - } -======= graph.syncRequest(new AsyncReadRequest() { @Override @@ -153,7 +112,6 @@ public class DocumentRequest extends VariableRead> { } }); ->>>>>>> 82fa68e Generate parts of db client query code ArrayList result = new ArrayList(rs); Collections.sort(result, new Comparator() {