You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@iotdb.apache.org by GitBox <gi...@apache.org> on 2021/02/04 06:09:07 UTC

[GitHub] [iotdb] jixuan1989 commented on a change in pull request #1337: [IOTDB-746] Add async insertion interfaces in Session and SessionPool

jixuan1989 commented on a change in pull request #1337:
URL: https://github.com/apache/iotdb/pull/1337#discussion_r569968680



##########
File path: session/src/main/java/org/apache/iotdb/session/Session.java
##########
@@ -478,6 +483,25 @@ private void handleRedirection(String deviceId, EndPoint endpoint)
     }
   }
 
+  /**
+   * insert data in one row, if you want improve your performance, please use insertInBatch method
+   * or insertBatch method
+   *
+   * @param timeout  asynchronous call timeout in millisecond
+   * @param callback user provided callback if failed, set to null if user does not specify.
+   * @see Session#insertRecords(List, List, List, List, List)
+   * @see Session#insertTablet(Tablet)
+   */
+  public CompletableFuture<Integer> asyncInsertRecord(
+          String deviceId, long time, List<String> measurements, List<TSDataType> types,
+          List<Object> values, long timeout,
+          SixInputConsumer<String, Long, List<String>, List<TSDataType>, List<Object>, Throwable> callback) {
+    ExecutorService singleThreadPool = Executors.newFixedThreadPool(1);

Review comment:
       use a  shared thread pool for all Async interfaces. 
   1. The size of the pool can be configured by users.
   2. The thread pool can be provided by users themself. (e.g., session pool can provide a thread pool for all sessions. )
   3. close the thread pool after session/sessionPool is closed.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org