]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.db.common/src/org/simantics/db/common/processor/MergingGraphRequestProcessor.java
Use java.util.Consumer instead of os.utils.datastructures.Callback
[simantics/platform.git] / bundles / org.simantics.db.common / src / org / simantics / db / common / processor / MergingGraphRequestProcessor.java
index 5e07bb034ecb924adc8567f99f09990e141e69ed..bf72e041648e4d11c4e0e4b1de8506b8e8397cf2 100644 (file)
@@ -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;
@@ -61,7 +62,6 @@ 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 {
@@ -374,7 +374,7 @@ public class MergingGraphRequestProcessor implements RequestProcessor {
                 }
 
                 @SuppressWarnings("unchecked")
-                Callback<Throwable> callback = (Callback<Throwable>)currentRequest.second;
+                Consumer<Throwable> callback = (Consumer<Throwable>)currentRequest.second;
 
                 if (currentRequest.first.getClass().equals(SyncWriteRequestAdapter.class)) {
 
@@ -383,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();
@@ -397,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);
                     }
 
                 }
@@ -482,7 +482,7 @@ public class MergingGraphRequestProcessor implements RequestProcessor {
     }
 
     @Override
-    public synchronized void asyncRequest(Write request, Callback<DatabaseException> callback) {
+    public synchronized void asyncRequest(Write request, Consumer<DatabaseException> callback) {
 
 //        System.out.println(this + " asyncRequest(WriteGraphRequest request)");
 
@@ -505,7 +505,7 @@ public class MergingGraphRequestProcessor implements RequestProcessor {
     }
 
     @Override
-    public synchronized void asyncRequest(DelayedWrite request, Callback<DatabaseException> callback) {
+    public synchronized void asyncRequest(DelayedWrite request, Consumer<DatabaseException> callback) {
 
 //        System.out.println(this + " asyncRequest(WriteGraphRequest request)");
 
@@ -528,7 +528,7 @@ public class MergingGraphRequestProcessor implements RequestProcessor {
     }
 
     @Override
-    public synchronized void asyncRequest(WriteOnly request, Callback<DatabaseException> callback) {
+    public synchronized void asyncRequest(WriteOnly request, Consumer<DatabaseException> callback) {
 
 //        System.out.println(this + " asyncRequest(WriteGraphRequest request)");