X-Git-Url: https://gerrit.simantics.org/r/gitweb?p=simantics%2Fplatform.git;a=blobdiff_plain;f=bundles%2Forg.simantics.db.common%2Fsrc%2Forg%2Fsimantics%2Fdb%2Fcommon%2Fprocessor%2FMergingGraphRequestProcessor.java;h=bf72e041648e4d11c4e0e4b1de8506b8e8397cf2;hp=acd2aad02c909e40a66eb22c406923aad39c0471;hb=56a799c9b7d395cefb59e101cd0f7ce8d68f88e6;hpb=0ae2b770234dfc3cbb18bd38f324125cf0faca07 diff --git a/bundles/org.simantics.db.common/src/org/simantics/db/common/processor/MergingGraphRequestProcessor.java b/bundles/org.simantics.db.common/src/org/simantics/db/common/processor/MergingGraphRequestProcessor.java index acd2aad02..bf72e0416 100644 --- a/bundles/org.simantics.db.common/src/org/simantics/db/common/processor/MergingGraphRequestProcessor.java +++ b/bundles/org.simantics.db.common/src/org/simantics/db/common/processor/MergingGraphRequestProcessor.java @@ -19,6 +19,7 @@ import java.util.LinkedList; import java.util.Set; import java.util.UUID; import java.util.concurrent.Semaphore; +import java.util.function.Consumer; import org.simantics.db.AsyncReadGraph; import org.simantics.db.AsyncRequestProcessor; @@ -26,7 +27,6 @@ import org.simantics.db.ReadGraph; import org.simantics.db.RequestProcessor; import org.simantics.db.Resource; import org.simantics.db.Session; -import org.simantics.db.VirtualGraph; import org.simantics.db.WriteGraph; import org.simantics.db.common.procedure.adapter.AsyncMultiProcedureAdapter; import org.simantics.db.common.procedure.adapter.ProcedureAdapter; @@ -56,14 +56,12 @@ import org.simantics.db.request.ExternalRead; import org.simantics.db.request.MultiRead; import org.simantics.db.request.Read; import org.simantics.db.request.ReadInterface; -import org.simantics.db.request.UndoTraits; import org.simantics.db.request.Write; import org.simantics.db.request.WriteInterface; import org.simantics.db.request.WriteOnly; import org.simantics.db.request.WriteOnlyResult; import org.simantics.db.request.WriteResult; import org.simantics.utils.DataContainer; -import org.simantics.utils.datastructures.Callback; import org.simantics.utils.datastructures.Pair; public class MergingGraphRequestProcessor implements RequestProcessor { @@ -126,15 +124,6 @@ public class MergingGraphRequestProcessor implements RequestProcessor { throw new RuntimeException("See cause for the real exception.", exception); } - @Override - public VirtualGraph getProvider() { - return null; - } - -// @Override -// public void fillMetadata(Map metadata) { -// } - public void acquire() { try { semaphore.acquire(); @@ -147,11 +136,6 @@ public class MergingGraphRequestProcessor implements RequestProcessor { semaphore.release(); } - @Override - public UndoTraits getUndoTraits() { - return null; - } - @Override public String toString() { return "SyncWriteRequestAdapter " + request; @@ -390,7 +374,7 @@ public class MergingGraphRequestProcessor implements RequestProcessor { } @SuppressWarnings("unchecked") - Callback callback = (Callback)currentRequest.second; + Consumer callback = (Consumer)currentRequest.second; if (currentRequest.first.getClass().equals(SyncWriteRequestAdapter.class)) { @@ -399,10 +383,10 @@ public class MergingGraphRequestProcessor implements RequestProcessor { try { // System.out.println("merg.sync " + adapter); graph.syncRequest(adapter); - if(callback != null) callback.run(null); + if(callback != null) callback.accept(null); } catch(Throwable t) { Logger.defaultLogError(t); - if(callback != null) callback.run(t); + if(callback != null) callback.accept(t); } adapter.release(); @@ -413,10 +397,10 @@ public class MergingGraphRequestProcessor implements RequestProcessor { try { if(currentRequest.first instanceof Write) graph.syncRequest((Write)currentRequest.first); else if(currentRequest.first instanceof DelayedWrite) graph.syncRequest((DelayedWrite)currentRequest.first); - if(callback != null) callback.run(null); + if(callback != null) callback.accept(null); } catch(Throwable t) { Logger.defaultLogError(t); - if(callback != null) callback.run(t); + if(callback != null) callback.accept(t); } } @@ -498,7 +482,7 @@ public class MergingGraphRequestProcessor implements RequestProcessor { } @Override - public synchronized void asyncRequest(Write request, Callback callback) { + public synchronized void asyncRequest(Write request, Consumer callback) { // System.out.println(this + " asyncRequest(WriteGraphRequest request)"); @@ -521,7 +505,7 @@ public class MergingGraphRequestProcessor implements RequestProcessor { } @Override - public synchronized void asyncRequest(DelayedWrite request, Callback callback) { + public synchronized void asyncRequest(DelayedWrite request, Consumer callback) { // System.out.println(this + " asyncRequest(WriteGraphRequest request)"); @@ -544,7 +528,7 @@ public class MergingGraphRequestProcessor implements RequestProcessor { } @Override - public synchronized void asyncRequest(WriteOnly request, Callback callback) { + public synchronized void asyncRequest(WriteOnly request, Consumer callback) { // System.out.println(this + " asyncRequest(WriteGraphRequest request)");