You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by hx...@apache.org on 2019/06/14 06:01:26 UTC

[incubator-iotdb] 02/02: add git status

This is an automated email from the ASF dual-hosted git repository.

hxd pushed a commit to branch feature_async_close_tsfile
in repository https://gitbox.apache.org/repos/asf/incubator-iotdb.git

commit 35db6918b48f10557df809c5f1b3407f2478d17b
Author: xiangdong huang <sa...@gmail.com>
AuthorDate: Fri Jun 14 14:01:12 2019 +0800

    add git status
---
 .../db/engine/filenode/FileNodeProcessor.java      | 68 +++++++++++-----------
 1 file changed, 34 insertions(+), 34 deletions(-)

diff --git a/iotdb/src/main/java/org/apache/iotdb/db/engine/filenode/FileNodeProcessor.java b/iotdb/src/main/java/org/apache/iotdb/db/engine/filenode/FileNodeProcessor.java
index c9d1077..40a72c4 100644
--- a/iotdb/src/main/java/org/apache/iotdb/db/engine/filenode/FileNodeProcessor.java
+++ b/iotdb/src/main/java/org/apache/iotdb/db/engine/filenode/FileNodeProcessor.java
@@ -2121,38 +2121,38 @@ public class FileNodeProcessor extends Processor implements IStatistic {
     }
   }
 
-//  /**
-//   * wait for all closing processors finishing their tasks
-//   */
-//  public void waitforAllClosed() throws FileNodeProcessorException {
-//    close();
-//    while (getClosingBufferWriteProcessor().size() != 0) {
-//      checkAllClosingProcessors();
-//      try {
-//        Thread.sleep(10);
-//      } catch (InterruptedException e) {
-//        LOGGER.error("Filenode Processor {} is interrupted when waiting for all closed.", processorName, e);
-//      }
-//    }
-//  }
-
-
-//  void checkAllClosingProcessors() {
-//    Iterator<BufferWriteProcessor> iterator =
-//        this.getClosingBufferWriteProcessor().iterator();
-//    while (iterator.hasNext()) {
-//      BufferWriteProcessor processor = iterator.next();
-//      try {
-//        if (processor.getCloseFuture().get(10, TimeUnit.MILLISECONDS)) {
-//          //if finished, we can remove it.
-//          iterator.remove();
-//        }
-//      } catch (InterruptedException | ExecutionException e) {
-//        LOGGER.error("Close bufferwrite processor {} failed.", processor.getProcessorName(), e);
-//      } catch (TimeoutException e) {
-//        //do nothing.
-//      }
-//    }
-//    this.getClosingBufferWriteProcessor().reset();
-//  }
+  /**
+   * wait for all closing processors finishing their tasks
+   */
+  public void waitforAllClosed() throws FileNodeProcessorException {
+    close();
+    while (getClosingBufferWriteProcessor().size() != 0) {
+      checkAllClosingProcessors();
+      try {
+        Thread.sleep(10);
+      } catch (InterruptedException e) {
+        LOGGER.error("Filenode Processor {} is interrupted when waiting for all closed.", processorName, e);
+      }
+    }
+  }
+
+
+  void checkAllClosingProcessors() {
+    Iterator<BufferWriteProcessor> iterator =
+        this.getClosingBufferWriteProcessor().iterator();
+    while (iterator.hasNext()) {
+      BufferWriteProcessor processor = iterator.next();
+      try {
+        if (processor.getCloseFuture().get(10, TimeUnit.MILLISECONDS)) {
+          //if finished, we can remove it.
+          iterator.remove();
+        }
+      } catch (InterruptedException | ExecutionException e) {
+        LOGGER.error("Close bufferwrite processor {} failed.", processor.getProcessorName(), e);
+      } catch (TimeoutException e) {
+        //do nothing.
+      }
+    }
+    this.getClosingBufferWriteProcessor().reset();
+  }
 }
\ No newline at end of file