]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.db/src/org/simantics/db/RequestProcessorSpecific.java
Merge "Multiple reader thread support for db client"
[simantics/platform.git] / bundles / org.simantics.db / src / org / simantics / db / RequestProcessorSpecific.java
index 523d410137a1341bec5e5b3e23f554a338b5c019..b121c0829be16e422439bf69425eea38c6a4f1b6 100644 (file)
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2007, 2010 Association for Decentralized Information Management
+ * Copyright (c) 2007, 2018 Association for Decentralized Information Management
  * in Industry THTH ry.
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
@@ -12,6 +12,7 @@
 package org.simantics.db;
 
 import java.util.Collection;
+import java.util.function.Consumer;
 
 import org.simantics.db.exception.DatabaseException;
 import org.simantics.db.procedure.AsyncListener;
@@ -82,7 +83,7 @@ import org.simantics.db.request.WriteResult;
  * @see MergingGraphRequestProcessor
  * @see AsyncRequestProcessor
  */
-public interface RequestProcessorSpecific extends AsyncRequestProcessor {
+public interface RequestProcessorSpecific {
 
     /**
      * Synchronously determines and returns the result of the given {@link Read}
@@ -288,7 +289,7 @@ public interface RequestProcessorSpecific extends AsyncRequestProcessor {
      * @param request an instance of {@link MultiRead}.
      * @param procedure an instance of {@link AsyncMultiListener}.
      */
-    <T> Collection<T> syncRequest(MultiRead<T> request, AsyncMultiListener<T> procedure) throws DatabaseException;
+    //<T> Collection<T> syncRequest(MultiRead<T> request, AsyncMultiListener<T> procedure) throws DatabaseException;
 
     /**
      * Synchronously registers the given {@link SyncMultiListener} (as
@@ -328,7 +329,7 @@ public interface RequestProcessorSpecific extends AsyncRequestProcessor {
      * @param request an instance of {@link MultiRead}.
      * @param procedure an instance of {@link AsyncMultiProcedure}.
      */
-    <T> Collection<T> syncRequest(MultiRead<T> request, AsyncMultiProcedure<T> procedure) throws DatabaseException;
+    //<T> Collection<T> syncRequest(MultiRead<T> request, AsyncMultiProcedure<T> procedure) throws DatabaseException;
 
     /**
      * Synchronously supplies the result determined from the given
@@ -496,5 +497,66 @@ public interface RequestProcessorSpecific extends AsyncRequestProcessor {
      * @param request an instance of {@link Write}.
      */
     <T> T syncRequest(WriteOnlyResult<T> r) throws DatabaseException;
-    
+
+    /**
+     * Asynchronously performs the given {@link Write}. The outcome of the
+     * request will be lost.
+     * 
+     * @param request an instance of {@link Write}.
+     */
+    void asyncRequest(Write request);
+
+    /**
+     * Asynchronously performs the given {@link Write}. The outcome of the
+     * request will be reported to given {@link Consumer} in the form of a
+     * DatabaseException raised during request processing or null upon success.
+     * 
+     * @param request an instance of {@link Write}.
+     * @param request an instance of {@link Consumer}.
+     */
+    void asyncRequest(Write request, Consumer<DatabaseException> callback);
+
+    <T> void asyncRequest(WriteResult<T> r, Procedure<T> procedure);
+
+
+    /**
+     * Asynchronously performs the given {@link WriteOnly}. The outcome of the
+     * request will be lost.
+     * 
+     * @param request an instance of {@link Write}.
+     */
+    void asyncRequest(DelayedWrite request);
+
+    /**
+     * Asynchronously performs the given {@link WriteOnly}. The outcome of the
+     * request will be reported to given {@link Consumer} in the form of a
+     * DatabaseException raised during request processing or null upon success.
+     * 
+     * @param request an instance of {@link WriteOnly}.
+     * @param request an instance of {@link Consumer}.
+     */
+    void asyncRequest(DelayedWrite request, Consumer<DatabaseException> callback);
+
+    <T> void asyncRequest(DelayedWriteResult<T> r, Procedure<T> procedure);
+
+    /**
+     * Asynchronously performs the given {@link WriteOnly}. The outcome of the
+     * request will be lost.
+     * 
+     * @param request an instance of {@link Write}.
+     */
+    void asyncRequest(WriteOnly r);
+
+    /**
+     * Asynchronously performs the given {@link WriteOnly}. The outcome of the
+     * request will be reported to given {@link Consumer} in the form of a
+     * DatabaseException raised during request processing or null upon success.
+     * 
+     * @param request an instance of {@link WriteOnly}.
+     * @param request an instance of {@link Consumer}.
+     */
+    void asyncRequest(WriteOnly r, Consumer<DatabaseException> callback);
+
+    <T> void asyncRequest(WriteOnlyResult<T> r, Procedure<T> procedure);
+
 }