You are viewing a plain text version of this content. The canonical link for it is here.
Posted to distributedlog-commits@bookkeeper.apache.org by zh...@apache.org on 2017/09/06 03:24:50 UTC

[distributedlog] branch master updated: ISSUE #166: Code cleanup for 0.5.0 release

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

zhaijia pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/distributedlog.git


The following commit(s) were added to refs/heads/master by this push:
     new f991a85  ISSUE #166: Code cleanup for 0.5.0 release
f991a85 is described below

commit f991a85e3a1b2c211459b54fa6ab0c266099579c
Author: Sijie Guo <si...@apache.org>
AuthorDate: Wed Sep 6 11:24:42 2017 +0800

    ISSUE #166: Code cleanup for 0.5.0 release
    
    Descriptions of the changes in this PR:
    
    - add InterfaceAudience and InterfaceStability for public API to inform people what changes would be expected for those interface.
    - avoid using guava classes in public API since we will provide a shaded jar for distributedlog-core
    - enable ImportOrder checkstyle rule in some modules
    - move `org.apache.distributedlog.io` to `distributedlog-common` module
    - rename `setReadyToFlush` to `flush` and rename `flushAndSync` to `commit` for the new API
    
    Author: Sijie Guo <si...@apache.org>
    
    Reviewers: Jia Zhai <None>, Leigh Stewart <None>
    
    This closes #172 from sijie/finalize_api, closes #166
---
 distributedlog-benchmark/pom.xml                   |   4 +-
 .../main/resources/distributedlog/checkstyle.xml   |   8 +-
 .../resources/distributedlog/suppressions-core.xml |  55 +++++++
 .../distributedlog/suppressions-packages.xml       |  33 +++++
 distributedlog-common/pom.xml                      |   7 +-
 .../common/config/ConfigurationSubscription.java   |   2 +-
 .../org/apache/distributedlog/io/Abortables.java   |   2 +-
 .../apache/distributedlog/io/CompressionCodec.java |   0
 .../apache/distributedlog/io/CompressionUtils.java |   0
 .../io/IdentityCompressionCodec.java               |   0
 .../distributedlog/io/LZ4CompressionCodec.java     |   0
 .../distributedlog/io/TestCompressionCodec.java    |  14 +-
 distributedlog-core-twitter/pom.xml                |   4 +-
 .../org/apache/distributedlog/LogWriterImpl.java   |   4 +-
 .../namespace/DistributedLogNamespaceImpl.java     |  18 ++-
 .../apache/distributedlog/TestLogWriterImpl.java   |   4 +-
 .../namespace/TestDistributedLogNamespaceImpl.java |   6 +-
 distributedlog-core/pom.xml                        |  33 +++++
 .../bookkeeper/client/BookKeeperAccessor.java      |   2 +-
 .../org/apache/bookkeeper/client/LedgerReader.java |  82 +++++------
 .../apache/bookkeeper/client}/package-info.java    |   7 +-
 .../apache/distributedlog/BKAsyncLogWriter.java    |   3 +-
 .../distributedlog/BKDistributedLogManager.java    |  43 +++---
 .../distributedlog/BKDistributedLogNamespace.java  |  39 +++--
 .../apache/distributedlog/BKLogSegmentWriter.java  |   2 +-
 .../org/apache/distributedlog/BKSyncLogWriter.java |   8 +-
 .../DistributedLogConfiguration.java               |  24 +++-
 .../org/apache/distributedlog/EntryBuffer.java     |   1 -
 .../distributedlog/EnvelopedEntryWriter.java       |   2 +-
 .../apache/distributedlog/api/AsyncLogReader.java  |   4 +
 .../apache/distributedlog/api/AsyncLogWriter.java  |  22 ++-
 .../distributedlog/api/DistributedLogManager.java  | 158 ++++++++++++++++-----
 .../org/apache/distributedlog/api/LogReader.java   |  11 +-
 .../org/apache/distributedlog/api/LogWriter.java   |  19 ++-
 .../distributedlog/api/MetadataAccessor.java       |  13 +-
 .../distributedlog/api/namespace/Namespace.java    |  20 +--
 .../api/namespace/NamespaceBuilder.java            |   9 +-
 .../distributedlog/TestAsyncReaderWriter.java      |  16 +--
 .../TestBKDistributedLogManager.java               |  28 ++--
 .../TestBKDistributedLogNamespace.java             |   2 +-
 .../apache/distributedlog/TestBKSyncLogReader.java |  16 +--
 .../apache/distributedlog/TestRollLogSegments.java |  12 +-
 distributedlog-protocol/pom.xml                    |   7 +-
 .../distributedlog/EnvelopedRecordSetWriter.java   |   3 +-
 .../java/org/apache/distributedlog/LogRecord.java  |   6 +
 .../distributedlog/{io => }/TransmitListener.java  |   8 +-
 .../src/main/resources/findbugsExclude.xml         |   6 -
 .../apache/distributedlog/TestLogRecordSet.java    |   2 +-
 distributedlog-proxy-client/pom.xml                |   4 +-
 distributedlog-proxy-protocol/pom.xml              |   2 +-
 .../protocol/util/ProtocolUtils.java               |   2 +-
 distributedlog-proxy-server/pom.xml                |   4 +-
 .../distributedlog/service/stream/StreamImpl.java  |   6 +-
 tests/jmh-0.4/pom.xml                              |  33 +++++
 .../apache/distributedlog/tests/package-info.java  |  17 +--
 tests/jmh/pom.xml                                  |  33 +++++
 .../apache/distributedlog/tests}/package-info.java |   7 +-
 57 files changed, 601 insertions(+), 276 deletions(-)

diff --git a/distributedlog-benchmark/pom.xml b/distributedlog-benchmark/pom.xml
index 8d18f0e..51fab13 100644
--- a/distributedlog-benchmark/pom.xml
+++ b/distributedlog-benchmark/pom.xml
@@ -134,7 +134,7 @@
         </dependencies>
         <configuration>
           <configLocation>distributedlog/checkstyle.xml</configLocation>
-          <suppressionsLocation>distributedlog/suppressions.xml</suppressionsLocation>
+          <suppressionsLocation>distributedlog/suppressions-packages.xml</suppressionsLocation>
           <consoleOutput>true</consoleOutput>
           <failOnViolation>true</failOnViolation>
           <includeResources>false</includeResources>
@@ -142,7 +142,7 @@
         </configuration>
         <executions>
           <execution>
-            <phase>test-compile</phase>
+            <phase>validate</phase>
             <goals>
               <goal>check</goal>
             </goals>
diff --git a/distributedlog-build-tools/src/main/resources/distributedlog/checkstyle.xml b/distributedlog-build-tools/src/main/resources/distributedlog/checkstyle.xml
index 28cd4ec..342f421 100644
--- a/distributedlog-build-tools/src/main/resources/distributedlog/checkstyle.xml
+++ b/distributedlog-build-tools/src/main/resources/distributedlog/checkstyle.xml
@@ -87,22 +87,16 @@ page at http://checkstyle.sourceforge.net/config.html -->
                value="Redundant import {0}."/>
     </module>
 
-    <!-- TODO: disable checkstyle for sort imports for repacking. re-enable it after the packages are renamed.
-         {@link https://issues.apache.org/jira/browse/DL-168}
     <module name="ImportOrder">
-      --><!-- Checks for out of order import statements. -->
-      <!--
+      <!-- Checks for out of order import statements. -->
       <property name="severity" value="error"/>
-      -->
       <!-- This ensures that static imports go first. -->
-      <!--
       <property name="option" value="top"/>
       <property name="sortStaticImportsAlphabetically" value="true"/>
       <property name="tokens" value="STATIC_IMPORT, IMPORT"/>
       <message key="import.ordering"
                value="Import {0} appears after other imports that it should precede"/>
     </module>
-    -->
 
     <module name="AvoidStarImport">
       <property name="severity" value="error"/>
diff --git a/distributedlog-build-tools/src/main/resources/distributedlog/suppressions-core.xml b/distributedlog-build-tools/src/main/resources/distributedlog/suppressions-core.xml
new file mode 100644
index 0000000..dd7eef0
--- /dev/null
+++ b/distributedlog-build-tools/src/main/resources/distributedlog/suppressions-core.xml
@@ -0,0 +1,55 @@
+<?xml version="1.0"?>
+<!--
+  Licensed under the Apache License, Version 2.0 (the "License");
+  you may not use this file except in compliance with the License.
+  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License. See accompanying LICENSE file.
+-->
+<!DOCTYPE suppressions PUBLIC
+"-//Puppy Crawl//DTD Suppressions 1.1//EN"
+"http://www.puppycrawl.com/dtds/suppressions_1_1.dtd">
+
+<suppressions>
+  <suppress checks="JavadocPackage" files=".*[\\/]src[\\/]test[\\/].*"/>
+  <suppress checks="JavadocPackage" files=".*[\\/]maven-archetypes[\\/].*"/>
+  <suppress checks="JavadocPackage" files=".*[\\/]examples[\\/].*"/>
+
+  <!-- suppress packages by packages -->
+  <!-- TODO: enable checkstyle package by package in https://github.com/apache/distributedlog/issues/165 -->
+  <suppress checks=".*" files=".*[\\/]distributedlog[\\/].*"/>
+  <suppress checks=".*" files=".*[\\/]distributedlog\.acl[\\/].*"/>
+  <suppress checks=".*" files=".*[\\/]distributedlog\.admin[\\/].*"/>
+  <suppress checks=".*" files=".*[\\/]distributedlog\.auditor[\\/].*"/>
+  <suppress checks=".*" files=".*[\\/]distributedlog\.bk[\\/].*"/>
+  <suppress checks=".*" files=".*[\\/]distributedlog\.callback[\\/].*"/>
+  <suppress checks=".*" files=".*[\\/]distributedlog\.config[\\/].*"/>
+  <suppress checks=".*" files=".*[\\/]distributedlog\.exceptions[\\/].*"/>
+  <suppress checks=".*" files=".*[\\/]distributedlog\.feature[\\/].*"/>
+  <suppress checks=".*" files=".*[\\/]distributedlog\.function[\\/].*"/>
+  <suppress checks=".*" files=".*[\\/]distributedlog\.impl[\\/].*"/>
+  <suppress checks=".*" files=".*[\\/]distributedlog\.injector[\\/].*"/>
+  <suppress checks=".*" files=".*[\\/]distributedlog\.limiter[\\/].*"/>
+  <suppress checks=".*" files=".*[\\/]distributedlog\.lock[\\/].*"/>
+  <suppress checks=".*" files=".*[\\/]distributedlog\.logsegment[\\/].*"/>
+  <suppress checks=".*" files=".*[\\/]distributedlog\.metadata[\\/].*"/>
+  <suppress checks=".*" files=".*[\\/]distributedlog\.namespace[\\/].*"/>
+  <suppress checks=".*" files=".*[\\/]distributedlog\.net[\\/].*"/>
+  <suppress checks=".*" files=".*[\\/]distributedlog\.selector[\\/].*"/>
+  <suppress checks=".*" files=".*[\\/]distributedlog\.tools[\\/].*"/>
+  <suppress checks=".*" files=".*[\\/]distributedlog\.util[\\/].*"/>
+  <suppress checks=".*" files=".*[\\/]distributedlog\.zk[\\/].*"/>
+
+  <!-- suppress all checks in the generated directories -->
+  <suppress checks=".*" files=".*[\\/]distributedlog\.thrift[\\/].*"/>
+  <suppress checks=".*" files=".+[\\/]generated[\\/].+\.java" />
+  <suppress checks=".*" files=".+[\\/]generated-sources[\\/].+\.java" />
+  <suppress checks=".*" files=".+[\\/]generated-test-sources[\\/].+\.java" />
+</suppressions>
+
diff --git a/distributedlog-build-tools/src/main/resources/distributedlog/suppressions-packages.xml b/distributedlog-build-tools/src/main/resources/distributedlog/suppressions-packages.xml
new file mode 100644
index 0000000..06eeaa9
--- /dev/null
+++ b/distributedlog-build-tools/src/main/resources/distributedlog/suppressions-packages.xml
@@ -0,0 +1,33 @@
+<?xml version="1.0"?>
+<!--
+  Licensed under the Apache License, Version 2.0 (the "License");
+  you may not use this file except in compliance with the License.
+  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License. See accompanying LICENSE file.
+-->
+<!DOCTYPE suppressions PUBLIC
+"-//Puppy Crawl//DTD Suppressions 1.1//EN"
+"http://www.puppycrawl.com/dtds/suppressions_1_1.dtd">
+
+<suppressions>
+  <suppress checks="JavadocPackage" files=".*[\\/]src[\\/]test[\\/].*"/>
+  <suppress checks="JavadocPackage" files=".*[\\/]maven-archetypes[\\/].*"/>
+  <suppress checks="JavadocPackage" files=".*[\\/]examples[\\/].*"/>
+
+  <!-- suppress ImportOrder -->
+  <!-- TODO: enable ImportOrder checkstyle rule in https://github.com/apache/distributedlog/issues/165 -->
+  <suppress checks="ImportOrder" files=".*[\\/]distributedlog[\\/].*"/>
+
+  <!-- suppress all checks in the generated directories -->
+  <suppress checks=".*" files=".+[\\/]generated[\\/].+\.java" />
+  <suppress checks=".*" files=".+[\\/]generated-sources[\\/].+\.java" />
+  <suppress checks=".*" files=".+[\\/]generated-test-sources[\\/].+\.java" />
+</suppressions>
+
diff --git a/distributedlog-common/pom.xml b/distributedlog-common/pom.xml
index 2129755..116db3c 100644
--- a/distributedlog-common/pom.xml
+++ b/distributedlog-common/pom.xml
@@ -74,6 +74,11 @@
       <version>${netty.version}</version>
     </dependency>
     <dependency>
+      <groupId>net.jpountz.lz4</groupId>
+      <artifactId>lz4</artifactId>
+      <version>${lz4.version}</version>
+    </dependency>
+    <dependency>
       <groupId>junit</groupId>
       <artifactId>junit</artifactId>
       <version>${junit.version}</version>
@@ -160,7 +165,7 @@
         </configuration>
         <executions>
           <execution>
-            <phase>test-compile</phase>
+            <phase>validate</phase>
             <goals>
               <goal>check</goal>
             </goals>
diff --git a/distributedlog-common/src/main/java/org/apache/distributedlog/common/config/ConfigurationSubscription.java b/distributedlog-common/src/main/java/org/apache/distributedlog/common/config/ConfigurationSubscription.java
index 72a5657..b6f3be5 100644
--- a/distributedlog-common/src/main/java/org/apache/distributedlog/common/config/ConfigurationSubscription.java
+++ b/distributedlog-common/src/main/java/org/apache/distributedlog/common/config/ConfigurationSubscription.java
@@ -24,12 +24,12 @@ import com.google.common.annotations.VisibleForTesting;
 import com.google.common.collect.Lists;
 import com.google.common.collect.Sets;
 import java.io.FileNotFoundException;
+import java.util.Iterator;
 import java.util.List;
 import java.util.Set;
 import java.util.concurrent.CopyOnWriteArraySet;
 import java.util.concurrent.ScheduledExecutorService;
 import java.util.concurrent.TimeUnit;
-import java.util.Iterator;
 import org.apache.commons.configuration.ConfigurationException;
 import org.apache.commons.configuration.FileConfiguration;
 import org.apache.commons.configuration.reloading.FileChangedReloadingStrategy;
diff --git a/distributedlog-common/src/main/java/org/apache/distributedlog/io/Abortables.java b/distributedlog-common/src/main/java/org/apache/distributedlog/io/Abortables.java
index b6101a8..73da1f1 100644
--- a/distributedlog-common/src/main/java/org/apache/distributedlog/io/Abortables.java
+++ b/distributedlog-common/src/main/java/org/apache/distributedlog/io/Abortables.java
@@ -24,8 +24,8 @@ import java.util.concurrent.CompletableFuture;
 import java.util.concurrent.ExecutorService;
 import javax.annotation.Nullable;
 import lombok.extern.slf4j.Slf4j;
-import org.apache.distributedlog.common.functions.VoidFunctions;
 import org.apache.distributedlog.common.concurrent.FutureUtils;
+import org.apache.distributedlog.common.functions.VoidFunctions;
 
 /**
  * Utility methods for working with {@link Abortable} objects.
diff --git a/distributedlog-protocol/src/main/java/org/apache/distributedlog/io/CompressionCodec.java b/distributedlog-common/src/main/java/org/apache/distributedlog/io/CompressionCodec.java
similarity index 100%
rename from distributedlog-protocol/src/main/java/org/apache/distributedlog/io/CompressionCodec.java
rename to distributedlog-common/src/main/java/org/apache/distributedlog/io/CompressionCodec.java
diff --git a/distributedlog-protocol/src/main/java/org/apache/distributedlog/io/CompressionUtils.java b/distributedlog-common/src/main/java/org/apache/distributedlog/io/CompressionUtils.java
similarity index 100%
rename from distributedlog-protocol/src/main/java/org/apache/distributedlog/io/CompressionUtils.java
rename to distributedlog-common/src/main/java/org/apache/distributedlog/io/CompressionUtils.java
diff --git a/distributedlog-protocol/src/main/java/org/apache/distributedlog/io/IdentityCompressionCodec.java b/distributedlog-common/src/main/java/org/apache/distributedlog/io/IdentityCompressionCodec.java
similarity index 100%
rename from distributedlog-protocol/src/main/java/org/apache/distributedlog/io/IdentityCompressionCodec.java
rename to distributedlog-common/src/main/java/org/apache/distributedlog/io/IdentityCompressionCodec.java
diff --git a/distributedlog-protocol/src/main/java/org/apache/distributedlog/io/LZ4CompressionCodec.java b/distributedlog-common/src/main/java/org/apache/distributedlog/io/LZ4CompressionCodec.java
similarity index 100%
rename from distributedlog-protocol/src/main/java/org/apache/distributedlog/io/LZ4CompressionCodec.java
rename to distributedlog-common/src/main/java/org/apache/distributedlog/io/LZ4CompressionCodec.java
diff --git a/distributedlog-protocol/src/test/java/org/apache/distributedlog/io/TestCompressionCodec.java b/distributedlog-common/src/test/java/org/apache/distributedlog/io/TestCompressionCodec.java
similarity index 96%
rename from distributedlog-protocol/src/test/java/org/apache/distributedlog/io/TestCompressionCodec.java
rename to distributedlog-common/src/test/java/org/apache/distributedlog/io/TestCompressionCodec.java
index 23bb8c6..5138c3d 100644
--- a/distributedlog-protocol/src/test/java/org/apache/distributedlog/io/TestCompressionCodec.java
+++ b/distributedlog-common/src/test/java/org/apache/distributedlog/io/TestCompressionCodec.java
@@ -1,4 +1,4 @@
-/**
+/*
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
  * distributed with this work for additional information
@@ -6,9 +6,9 @@
  * to you under the Apache License, Version 2.0 (the
  * "License"); you may not use this file except in compliance
  * with the License.  You may obtain a copy of the License at
- * <p>
- * http://www.apache.org/licenses/LICENSE-2.0
- * <p>
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -24,10 +24,8 @@ import static org.junit.Assert.assertEquals;
 import io.netty.buffer.ByteBuf;
 import io.netty.buffer.PooledByteBufAllocator;
 import io.netty.buffer.Unpooled;
-import org.apache.distributedlog.LogRecord;
-import org.junit.Test;
-
 import java.nio.ByteBuffer;
+import org.junit.Test;
 
 /**
  * Test Case for {@link CompressionCodec}.
@@ -78,7 +76,7 @@ public class TestCompressionCodec {
     }
 
     private void testCompressionCodec2(CompressionCodec codec) throws Exception {
-        ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer(32, LogRecord.MAX_LOGRECORDSET_SIZE);
+        ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer(32, 4 * 1024 * 1024);
         for (int i = 0; i < 100; i++) {
             ByteBuffer record = ByteBuffer.wrap(("record-" + i).getBytes(UTF_8));
             buffer.writeInt(record.remaining());
diff --git a/distributedlog-core-twitter/pom.xml b/distributedlog-core-twitter/pom.xml
index 9cf11be..6ef2b01 100644
--- a/distributedlog-core-twitter/pom.xml
+++ b/distributedlog-core-twitter/pom.xml
@@ -121,7 +121,7 @@
         </dependencies>
         <configuration>
           <configLocation>distributedlog/checkstyle.xml</configLocation>
-          <suppressionsLocation>distributedlog/suppressions.xml</suppressionsLocation>
+          <suppressionsLocation>distributedlog/suppressions-packages.xml</suppressionsLocation>
           <consoleOutput>true</consoleOutput>
           <failOnViolation>true</failOnViolation>
           <includeResources>false</includeResources>
@@ -129,7 +129,7 @@
         </configuration>
         <executions>
           <execution>
-            <phase>test-compile</phase>
+            <phase>validate</phase>
             <goals>
               <goal>check</goal>
             </goals>
diff --git a/distributedlog-core-twitter/src/main/java/org/apache/distributedlog/LogWriterImpl.java b/distributedlog-core-twitter/src/main/java/org/apache/distributedlog/LogWriterImpl.java
index 532b3e5..0328b59 100644
--- a/distributedlog-core-twitter/src/main/java/org/apache/distributedlog/LogWriterImpl.java
+++ b/distributedlog-core-twitter/src/main/java/org/apache/distributedlog/LogWriterImpl.java
@@ -50,12 +50,12 @@ class LogWriterImpl implements LogWriter {
 
     @Override
     public long setReadyToFlush() throws IOException {
-        return impl.setReadyToFlush();
+        return impl.flush();
     }
 
     @Override
     public long flushAndSync() throws IOException {
-        return impl.flushAndSync();
+        return impl.commit();
     }
 
     @Override
diff --git a/distributedlog-core-twitter/src/main/java/org/apache/distributedlog/namespace/DistributedLogNamespaceImpl.java b/distributedlog-core-twitter/src/main/java/org/apache/distributedlog/namespace/DistributedLogNamespaceImpl.java
index a528d62..beaea49 100644
--- a/distributedlog-core-twitter/src/main/java/org/apache/distributedlog/namespace/DistributedLogNamespaceImpl.java
+++ b/distributedlog-core-twitter/src/main/java/org/apache/distributedlog/namespace/DistributedLogNamespaceImpl.java
@@ -37,13 +37,20 @@ import org.apache.distributedlog.exceptions.LogNotFoundException;
  */
 class DistributedLogNamespaceImpl implements DistributedLogNamespace {
 
+    private static <T> java.util.Optional<T> gOptional2JOptional(Optional<T> gOptional) {
+        if (gOptional.isPresent()) {
+            return java.util.Optional.of(gOptional.get());
+        } else {
+            return java.util.Optional.empty();
+        }
+    }
+
     private final Namespace impl;
 
     DistributedLogNamespaceImpl(Namespace impl) {
         this.impl = impl;
     }
 
-
     @Override
     public NamespaceDriver getNamespaceDriver() {
         return impl.getNamespaceDriver();
@@ -70,8 +77,13 @@ class DistributedLogNamespaceImpl implements DistributedLogNamespace {
                                          Optional<DynamicDistributedLogConfiguration> dynamicLogConf,
                                          Optional<StatsLogger> perStreamStatsLogger)
             throws InvalidStreamNameException, IOException {
-        return new DistributedLogManagerImpl(impl.openLog(
-            logName, logConf, dynamicLogConf, perStreamStatsLogger));
+        return new DistributedLogManagerImpl(
+            impl.openLog(
+                logName,
+                gOptional2JOptional(logConf),
+                gOptional2JOptional(dynamicLogConf),
+                gOptional2JOptional(perStreamStatsLogger)
+            ));
     }
 
     @Override
diff --git a/distributedlog-core-twitter/src/test/java/org/apache/distributedlog/TestLogWriterImpl.java b/distributedlog-core-twitter/src/test/java/org/apache/distributedlog/TestLogWriterImpl.java
index be69260..4f5b2d2 100644
--- a/distributedlog-core-twitter/src/test/java/org/apache/distributedlog/TestLogWriterImpl.java
+++ b/distributedlog-core-twitter/src/test/java/org/apache/distributedlog/TestLogWriterImpl.java
@@ -52,13 +52,13 @@ public class TestLogWriterImpl {
     @Test
     public void testSetReadyToFlush() throws Exception {
         writer.setReadyToFlush();
-        verify(underlying, times(1)).setReadyToFlush();
+        verify(underlying, times(1)).flush();
     }
 
     @Test
     public void testFlushAndSync() throws Exception {
         writer.flushAndSync();
-        verify(underlying, times(1)).flushAndSync();
+        verify(underlying, times(1)).commit();
     }
 
     @Test
diff --git a/distributedlog-core-twitter/src/test/java/org/apache/distributedlog/namespace/TestDistributedLogNamespaceImpl.java b/distributedlog-core-twitter/src/test/java/org/apache/distributedlog/namespace/TestDistributedLogNamespaceImpl.java
index b562fe4..85faf03 100644
--- a/distributedlog-core-twitter/src/test/java/org/apache/distributedlog/namespace/TestDistributedLogNamespaceImpl.java
+++ b/distributedlog-core-twitter/src/test/java/org/apache/distributedlog/namespace/TestDistributedLogNamespaceImpl.java
@@ -76,7 +76,11 @@ public class TestDistributedLogNamespaceImpl {
         String logName = "test-open-log";
         namespace.openLog(logName, Optional.absent(), Optional.absent(), Optional.absent());
         verify(impl, times(1))
-            .openLog(eq(logName), eq(Optional.absent()), eq(Optional.absent()), eq(Optional.absent()));
+            .openLog(
+                eq(logName),
+                eq(java.util.Optional.empty()),
+                eq(java.util.Optional.empty()),
+                eq(java.util.Optional.empty()));
     }
 
     @Test
diff --git a/distributedlog-core/pom.xml b/distributedlog-core/pom.xml
index d561c5e..d439cb2 100644
--- a/distributedlog-core/pom.xml
+++ b/distributedlog-core/pom.xml
@@ -323,6 +323,39 @@
           </execution>
         </executions>
       </plugin>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-checkstyle-plugin</artifactId>
+        <version>${maven-checkstyle-plugin.version}</version>
+        <dependencies>
+          <dependency>
+            <groupId>com.puppycrawl.tools</groupId>
+            <artifactId>checkstyle</artifactId>
+            <version>${puppycrawl.checkstyle.version}</version>
+          </dependency>
+          <dependency>
+            <groupId>org.apache.distributedlog</groupId>
+            <artifactId>distributedlog-build-tools</artifactId>
+            <version>${project.version}</version>
+          </dependency>
+        </dependencies>
+        <configuration>
+          <configLocation>distributedlog/checkstyle.xml</configLocation>
+          <suppressionsLocation>distributedlog/suppressions-core.xml</suppressionsLocation>
+          <consoleOutput>true</consoleOutput>
+          <failOnViolation>true</failOnViolation>
+          <includeResources>false</includeResources>
+          <includeTestSourceDirectory>true</includeTestSourceDirectory>
+        </configuration>
+        <executions>
+          <execution>
+            <phase>validate</phase>
+            <goals>
+              <goal>check</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>
     </plugins>
   </build>
   <profiles>
diff --git a/distributedlog-core/src/main/java/org/apache/bookkeeper/client/BookKeeperAccessor.java b/distributedlog-core/src/main/java/org/apache/bookkeeper/client/BookKeeperAccessor.java
index dcba24e..8978ff3 100644
--- a/distributedlog-core/src/main/java/org/apache/bookkeeper/client/BookKeeperAccessor.java
+++ b/distributedlog-core/src/main/java/org/apache/bookkeeper/client/BookKeeperAccessor.java
@@ -21,7 +21,7 @@ import org.apache.bookkeeper.meta.LedgerManager;
 import org.apache.bookkeeper.proto.BookkeeperInternalCallbacks;
 
 /**
- * Accessor to protected methods in bookkeeper
+ * Accessor to protected methods in bookkeeper.
  */
 public class BookKeeperAccessor {
 
diff --git a/distributedlog-core/src/main/java/org/apache/bookkeeper/client/LedgerReader.java b/distributedlog-core/src/main/java/org/apache/bookkeeper/client/LedgerReader.java
index 2ab2bca..b102912 100644
--- a/distributedlog-core/src/main/java/org/apache/bookkeeper/client/LedgerReader.java
+++ b/distributedlog-core/src/main/java/org/apache/bookkeeper/client/LedgerReader.java
@@ -35,14 +35,15 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 /**
- * Reader used for DL tools to read entries
- *
- * TODO: move this to bookkeeper project?
+ * Reader used for DL tools to read entries.
  */
 public class LedgerReader {
 
-    static final Logger logger = LoggerFactory.getLogger(LedgerReader.class);
+    private static final Logger logger = LoggerFactory.getLogger(LedgerReader.class);
 
+    /**
+     * Read Result Holder.
+     */
     public static class ReadResult<T> {
         final long entryId;
         final int rc;
@@ -79,7 +80,7 @@ public class LedgerReader {
         bookieClient = bkc.getBookieClient();
     }
 
-    static public SortedMap<Long, ArrayList<BookieSocketAddress>> bookiesForLedger(final LedgerHandle lh) {
+    public static SortedMap<Long, ArrayList<BookieSocketAddress>> bookiesForLedger(final LedgerHandle lh) {
         return lh.getLedgerMetadata().getEnsembles();
     }
 
@@ -102,7 +103,8 @@ public class LedgerReader {
                         ByteBuf toRet = Unpooled.copiedBuffer(content);
                         rr = new ReadResult<>(eid, BKException.Code.OK, toRet, bookieAddress.getSocketAddress());
                     } catch (BKException.BKDigestMatchException e) {
-                        rr = new ReadResult<>(eid, BKException.Code.DigestMatchException, null, bookieAddress.getSocketAddress());
+                        rr = new ReadResult<>(
+                            eid, BKException.Code.DigestMatchException, null, bookieAddress.getSocketAddress());
                     } finally {
                         buffer.release();
                     }
@@ -151,27 +153,24 @@ public class LedgerReader {
             }
         };
 
-        ReadLastConfirmedOp.LastConfirmedDataCallback readLACCallback = new ReadLastConfirmedOp.LastConfirmedDataCallback() {
-            @Override
-            public void readLastConfirmedDataComplete(int rc, DigestManager.RecoveryData recoveryData) {
-                if (BKException.Code.OK != rc) {
-                    callback.operationComplete(rc, resultList);
-                    return;
-                }
+        ReadLastConfirmedOp.LastConfirmedDataCallback readLACCallback = (rc, recoveryData) -> {
+            if (BKException.Code.OK != rc) {
+                callback.operationComplete(rc, resultList);
+                return;
+            }
 
-                if (LedgerHandle.INVALID_ENTRY_ID >= recoveryData.lastAddConfirmed) {
-                    callback.operationComplete(BKException.Code.OK, resultList);
-                    return;
-                }
+            if (LedgerHandle.INVALID_ENTRY_ID >= recoveryData.lastAddConfirmed) {
+                callback.operationComplete(BKException.Code.OK, resultList);
+                return;
+            }
 
-                long entryId = recoveryData.lastAddConfirmed;
-                PendingReadOp readOp = new PendingReadOp(lh, lh.bk.scheduler, entryId, entryId, readCallback, entryId);
-                try {
-                    readOp.initiate();
-                } catch (Throwable t) {
-                    logger.error("Failed to initialize pending read entry {} for ledger {} : ",
-                                 new Object[] { entryId, lh.getLedgerMetadata(), t });
-                }
+            long entryId = recoveryData.lastAddConfirmed;
+            PendingReadOp readOp = new PendingReadOp(lh, lh.bk.scheduler, entryId, entryId, readCallback, entryId);
+            try {
+                readOp.initiate();
+            } catch (Throwable t) {
+                logger.error("Failed to initialize pending read entry {} for ledger {} : ",
+                             new Object[] { entryId, lh.getLedgerMetadata(), t });
             }
         };
         // Read Last AddConfirmed
@@ -183,26 +182,23 @@ public class LedgerReader {
         List<Integer> writeSet = lh.distributionSchedule.getWriteSet(eid);
         final AtomicInteger numBookies = new AtomicInteger(writeSet.size());
         final Set<ReadResult<Long>> readResults = new HashSet<ReadResult<Long>>();
-        ReadEntryCallback readEntryCallback = new ReadEntryCallback() {
-            @Override
-            public void readEntryComplete(int rc, long lid, long eid, ByteBuf buffer, Object ctx) {
-                InetSocketAddress bookieAddress = (InetSocketAddress) ctx;
-                ReadResult<Long> rr;
-                if (BKException.Code.OK != rc) {
-                    rr = new ReadResult<Long>(eid, rc, null, bookieAddress);
-                } else {
-                    try {
-                        DigestManager.RecoveryData data = lh.macManager.verifyDigestAndReturnLastConfirmed(buffer);
-                        rr = new ReadResult<Long>(eid, BKException.Code.OK, data.lastAddConfirmed, bookieAddress);
-                    } catch (BKException.BKDigestMatchException e) {
-                        rr = new ReadResult<Long>(eid, BKException.Code.DigestMatchException, null, bookieAddress);
-                    }
-                }
-                readResults.add(rr);
-                if (numBookies.decrementAndGet() == 0) {
-                    callback.operationComplete(BKException.Code.OK, readResults);
+        ReadEntryCallback readEntryCallback = (rc, lid, eid1, buffer, ctx) -> {
+            InetSocketAddress bookieAddress = (InetSocketAddress) ctx;
+            ReadResult<Long> rr;
+            if (BKException.Code.OK != rc) {
+                rr = new ReadResult<Long>(eid1, rc, null, bookieAddress);
+            } else {
+                try {
+                    DigestManager.RecoveryData data = lh.macManager.verifyDigestAndReturnLastConfirmed(buffer);
+                    rr = new ReadResult<Long>(eid1, BKException.Code.OK, data.lastAddConfirmed, bookieAddress);
+                } catch (BKException.BKDigestMatchException e) {
+                    rr = new ReadResult<Long>(eid1, BKException.Code.DigestMatchException, null, bookieAddress);
                 }
             }
+            readResults.add(rr);
+            if (numBookies.decrementAndGet() == 0) {
+                callback.operationComplete(BKException.Code.OK, readResults);
+            }
         };
 
         ArrayList<BookieSocketAddress> ensemble = lh.getLedgerMetadata().getEnsemble(eid);
diff --git a/distributedlog-protocol/src/main/java/org/apache/distributedlog/io/package-info.java b/distributedlog-core/src/main/java/org/apache/bookkeeper/client/package-info.java
similarity index 89%
copy from distributedlog-protocol/src/main/java/org/apache/distributedlog/io/package-info.java
copy to distributedlog-core/src/main/java/org/apache/bookkeeper/client/package-info.java
index 740359b..ca57107 100644
--- a/distributedlog-protocol/src/main/java/org/apache/distributedlog/io/package-info.java
+++ b/distributedlog-core/src/main/java/org/apache/bookkeeper/client/package-info.java
@@ -1,4 +1,4 @@
-/**
+/*
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
  * distributed with this work for additional information
@@ -15,7 +15,8 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
+
 /**
- * I/O related utilities used across the project.
+ * DistributedLog overrides on bookkeeper client.
  */
-package org.apache.distributedlog.io;
+package org.apache.bookkeeper.client;
\ No newline at end of file
diff --git a/distributedlog-core/src/main/java/org/apache/distributedlog/BKAsyncLogWriter.java b/distributedlog-core/src/main/java/org/apache/distributedlog/BKAsyncLogWriter.java
index 62b32f2..abcc4c4 100644
--- a/distributedlog-core/src/main/java/org/apache/distributedlog/BKAsyncLogWriter.java
+++ b/distributedlog-core/src/main/java/org/apache/distributedlog/BKAsyncLogWriter.java
@@ -463,7 +463,8 @@ class BKAsyncLogWriter extends BKAbstractLogWriter implements AsyncLogWriter {
         return writerFuture.thenCompose(writer -> writer.flushAndCommit());
     }
 
-    CompletableFuture<Long> markEndOfStream() {
+    @Override
+    public CompletableFuture<Long> markEndOfStream() {
         final Stopwatch stopwatch = Stopwatch.createStarted();
         CompletableFuture<BKLogSegmentWriter> logSegmentWriterFuture;
         synchronized (this) {
diff --git a/distributedlog-core/src/main/java/org/apache/distributedlog/BKDistributedLogManager.java b/distributedlog-core/src/main/java/org/apache/distributedlog/BKDistributedLogManager.java
index c837ad2..0289624 100644
--- a/distributedlog-core/src/main/java/org/apache/distributedlog/BKDistributedLogManager.java
+++ b/distributedlog-core/src/main/java/org/apache/distributedlog/BKDistributedLogManager.java
@@ -17,9 +17,18 @@
  */
 package org.apache.distributedlog;
 
+import static org.apache.distributedlog.namespace.NamespaceDriver.Role.READER;
+import static org.apache.distributedlog.namespace.NamespaceDriver.Role.WRITER;
+
 import com.google.common.annotations.VisibleForTesting;
 import com.google.common.base.Optional;
 import com.google.common.base.Preconditions;
+import java.io.IOException;
+import java.net.URI;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+import java.util.concurrent.ExecutorService;
 import java.util.concurrent.CancellationException;
 import java.util.concurrent.CompletableFuture;
 import java.util.function.Function;
@@ -62,16 +71,6 @@ import org.apache.distributedlog.util.Utils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import java.io.IOException;
-import java.net.URI;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-import java.util.concurrent.ExecutorService;
-
-import static org.apache.distributedlog.namespace.NamespaceDriver.Role.READER;
-import static org.apache.distributedlog.namespace.NamespaceDriver.Role.WRITER;
-
 /**
  * <h3>Metrics</h3>
  * <ul>
@@ -79,10 +78,6 @@ import static org.apache.distributedlog.namespace.NamespaceDriver.Role.WRITER;
  * See {@link BKAsyncLogWriter} for detail stats.
  * <li> `async_reader/*`: all asyncrhonous reader related metrics are exposed under scope `async_reader`.
  * See {@link BKAsyncLogReader} for detail stats.
- * <li> `writer_future_pool/*`: metrics about the future pools that used by writers are exposed under
- * scope `writer_future_pool`. See {@link MonitoredFuturePool} for detail stats.
- * <li> `reader_future_pool/*`: metrics about the future pools that used by readers are exposed under
- * scope `reader_future_pool`. See {@link MonitoredFuturePool} for detail stats.
  * <li> `lock/*`: metrics about the locks used by writers. See {@link ZKDistributedLock} for detail
  * stats.
  * <li> `read_lock/*`: metrics about the locks used by readers. See {@link ZKDistributedLock} for
@@ -476,6 +471,11 @@ class BKDistributedLogManager implements DistributedLogManager {
      */
     @Override
     public BKSyncLogWriter startLogSegmentNonPartitioned() throws IOException {
+        return openLogWriter();
+    }
+
+    @Override
+    public BKSyncLogWriter openLogWriter() throws IOException {
         checkClosedOrInError("startLogSegmentNonPartitioned");
         BKSyncLogWriter writer = new BKSyncLogWriter(conf, dynConf, this);
         boolean success = false;
@@ -606,17 +606,28 @@ class BKDistributedLogManager implements DistributedLogManager {
      * @throws IOException if a stream cannot be found.
      */
     @Override
-    public LogReader getInputStream(long fromTxnId)
+    public LogReader openLogReader(long fromTxnId)
         throws IOException {
         return getInputStreamInternal(fromTxnId);
     }
 
     @Override
-    public LogReader getInputStream(DLSN fromDLSN) throws IOException {
+    public LogReader openLogReader(DLSN fromDLSN) throws IOException {
         return getInputStreamInternal(fromDLSN, Optional.<Long>absent());
     }
 
     @Override
+    public LogReader getInputStream(long fromTxnId)
+        throws IOException {
+        return openLogReader(fromTxnId);
+    }
+
+    @Override
+    public LogReader getInputStream(DLSN fromDLSN) throws IOException {
+        return openLogReader(fromDLSN);
+    }
+
+    @Override
     public AsyncLogReader getAsyncLogReader(long fromTxnId) throws IOException {
         return Utils.ioResult(openAsyncLogReader(fromTxnId));
     }
diff --git a/distributedlog-core/src/main/java/org/apache/distributedlog/BKDistributedLogNamespace.java b/distributedlog-core/src/main/java/org/apache/distributedlog/BKDistributedLogNamespace.java
index 60ad916..0264178 100644
--- a/distributedlog-core/src/main/java/org/apache/distributedlog/BKDistributedLogNamespace.java
+++ b/distributedlog-core/src/main/java/org/apache/distributedlog/BKDistributedLogNamespace.java
@@ -17,8 +17,16 @@
  */
 package org.apache.distributedlog;
 
-import com.google.common.base.Optional;
+import static org.apache.distributedlog.namespace.NamespaceDriver.Role.WRITER;
+import static org.apache.distributedlog.util.DLUtils.validateAndNormalizeName;
+
 import com.google.common.base.Ticker;
+import java.io.IOException;
+import java.net.URI;
+import java.util.Iterator;
+import java.util.Optional;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.AtomicBoolean;
 import org.apache.distributedlog.acl.AccessControlManager;
 import org.apache.distributedlog.api.DistributedLogManager;
 import org.apache.distributedlog.api.namespace.Namespace;
@@ -28,7 +36,6 @@ import org.apache.distributedlog.exceptions.AlreadyClosedException;
 import org.apache.distributedlog.exceptions.InvalidStreamNameException;
 import org.apache.distributedlog.exceptions.LogNotFoundException;
 import org.apache.distributedlog.injector.AsyncFailureInjector;
-import org.apache.distributedlog.io.AsyncCloseable;
 import org.apache.distributedlog.logsegment.LogSegmentMetadataCache;
 import org.apache.distributedlog.namespace.NamespaceDriver;
 import org.apache.distributedlog.util.ConfUtils;
@@ -41,15 +48,6 @@ import org.apache.bookkeeper.stats.StatsLogger;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import java.io.IOException;
-import java.net.URI;
-import java.util.Iterator;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.atomic.AtomicBoolean;
-
-import static org.apache.distributedlog.namespace.NamespaceDriver.Role.WRITER;
-import static org.apache.distributedlog.util.DLUtils.validateAndNormalizeName;
-
 /**
  * BKDistributedLogNamespace is the default implementation of {@link Namespace}. It uses
  * zookeeper for metadata storage and bookkeeper for data storage.
@@ -155,15 +153,15 @@ public class BKDistributedLogNamespace implements Namespace {
             throws InvalidStreamNameException, LogNotFoundException, IOException {
         checkState();
         logName = validateAndNormalizeName(logName);
-        Optional<URI> uri = Utils.ioResult(driver.getLogMetadataStore().getLogLocation(logName));
+        com.google.common.base.Optional<URI> uri = Utils.ioResult(driver.getLogMetadataStore().getLogLocation(logName));
         if (!uri.isPresent()) {
             throw new LogNotFoundException("Log " + logName + " isn't found.");
         }
         DistributedLogManager dlm = openLogInternal(
                 uri.get(),
                 logName,
-                Optional.<DistributedLogConfiguration>absent(),
-                Optional.<DynamicDistributedLogConfiguration>absent());
+                Optional.empty(),
+                Optional.empty());
         dlm.delete();
     }
 
@@ -171,9 +169,9 @@ public class BKDistributedLogNamespace implements Namespace {
     public DistributedLogManager openLog(String logName)
             throws InvalidStreamNameException, IOException {
         return openLog(logName,
-                Optional.<DistributedLogConfiguration>absent(),
-                Optional.<DynamicDistributedLogConfiguration>absent(),
-                Optional.<StatsLogger>absent());
+                Optional.empty(),
+                Optional.empty(),
+                Optional.empty());
     }
 
     @Override
@@ -184,7 +182,7 @@ public class BKDistributedLogNamespace implements Namespace {
             throws InvalidStreamNameException, IOException {
         checkState();
         logName = validateAndNormalizeName(logName);
-        Optional<URI> uri = Utils.ioResult(driver.getLogMetadataStore().getLogLocation(logName));
+        com.google.common.base.Optional<URI> uri = Utils.ioResult(driver.getLogMetadataStore().getLogLocation(logName));
         if (!uri.isPresent()) {
             throw new LogNotFoundException("Log " + logName + " isn't found.");
         }
@@ -199,7 +197,7 @@ public class BKDistributedLogNamespace implements Namespace {
     public boolean logExists(String logName)
         throws IOException, IllegalArgumentException {
         checkState();
-        Optional<URI> uri = Utils.ioResult(driver.getLogMetadataStore().getLogLocation(logName));
+        com.google.common.base.Optional<URI> uri = Utils.ioResult(driver.getLogMetadataStore().getLogLocation(logName));
         if (uri.isPresent()) {
             try {
                 Utils.ioResult(driver.getLogStreamMetadataStore(WRITER)
@@ -281,7 +279,8 @@ public class BKDistributedLogNamespace implements Namespace {
                 failureInjector,                    /* Failure Injector */
                 statsLogger,                        /* Stats Logger */
                 perLogStatsLogger,                  /* Per Log Stats Logger */
-                Optional.<AsyncCloseable>absent()   /* shared resources, we don't need to close any resources in dlm */
+                com.google.common.base.Optional.absent()
+                                                    /* shared resources, we don't need to close any resources in dlm */
         );
     }
 
diff --git a/distributedlog-core/src/main/java/org/apache/distributedlog/BKLogSegmentWriter.java b/distributedlog-core/src/main/java/org/apache/distributedlog/BKLogSegmentWriter.java
index 48a0daf..e2178dc 100644
--- a/distributedlog-core/src/main/java/org/apache/distributedlog/BKLogSegmentWriter.java
+++ b/distributedlog-core/src/main/java/org/apache/distributedlog/BKLogSegmentWriter.java
@@ -995,7 +995,7 @@ class BKLogSegmentWriter implements LogSegmentWriter, AddCallback, Runnable, Siz
 
     /**
      * Transmit the current buffer to bookkeeper.
-     * Synchronised at the class. #write() and #setReadyToFlush()
+     * Synchronised at the class. #write() and #flush()
      * are never called at the same time.
      *
      * NOTE: This method should only throw known exceptions so that we don't accidentally
diff --git a/distributedlog-core/src/main/java/org/apache/distributedlog/BKSyncLogWriter.java b/distributedlog-core/src/main/java/org/apache/distributedlog/BKSyncLogWriter.java
index 15296b2..f16914f 100644
--- a/distributedlog-core/src/main/java/org/apache/distributedlog/BKSyncLogWriter.java
+++ b/distributedlog-core/src/main/java/org/apache/distributedlog/BKSyncLogWriter.java
@@ -68,8 +68,8 @@ class BKSyncLogWriter extends BKAbstractLogWriter implements LogWriter {
      * New data can be still written to the stream while flush is ongoing.
      */
     @Override
-    public long setReadyToFlush() throws IOException {
-        checkClosedOrInError("setReadyToFlush");
+    public long flush() throws IOException {
+        checkClosedOrInError("flush");
         long highestTransactionId = 0;
         BKLogSegmentWriter writer = getCachedLogWriter();
         if (null != writer) {
@@ -86,8 +86,8 @@ class BKSyncLogWriter extends BKAbstractLogWriter implements LogWriter {
      * becomes full or a certain period of time is elapsed.
      */
     @Override
-    public long flushAndSync() throws IOException {
-        checkClosedOrInError("flushAndSync");
+    public long commit() throws IOException {
+        checkClosedOrInError("commit");
 
         LOG.debug("FlushAndSync Started");
         long highestTransactionId = 0;
diff --git a/distributedlog-core/src/main/java/org/apache/distributedlog/DistributedLogConfiguration.java b/distributedlog-core/src/main/java/org/apache/distributedlog/DistributedLogConfiguration.java
index 3269f57..613e60c 100644
--- a/distributedlog-core/src/main/java/org/apache/distributedlog/DistributedLogConfiguration.java
+++ b/distributedlog-core/src/main/java/org/apache/distributedlog/DistributedLogConfiguration.java
@@ -20,6 +20,10 @@ package org.apache.distributedlog;
 import com.google.common.base.Optional;
 import com.google.common.base.Preconditions;
 import com.google.common.collect.Sets;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.Set;
 import org.apache.distributedlog.bk.QuorumConfig;
 import org.apache.distributedlog.feature.DefaultFeatureProvider;
 import org.apache.distributedlog.api.namespace.NamespaceBuilder;
@@ -39,13 +43,9 @@ import org.apache.commons.lang.StringUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.Set;
-
 /**
  * DistributedLog Configuration.
+ *
  * <p>
  * DistributedLog configuration is basically a properties based configuration, which extends from
  * Apache commons {@link CompositeConfiguration}. All the DL settings are in camel case and prefixed
@@ -527,8 +527,22 @@ public class DistributedLogConfiguration extends CompositeConfiguration {
      * Load whitelisted stream configuration from another configuration object
      *
      * @param streamConfiguration stream configuration overrides
+     * @Deprecated since 0.5.0, in favor of using {@link #loadStreamConf(java.util.Optional)}
      */
     public void loadStreamConf(Optional<DistributedLogConfiguration> streamConfiguration) {
+        if (streamConfiguration.isPresent()) {
+            loadStreamConf(java.util.Optional.of(streamConfiguration.get()));
+        } else {
+            loadStreamConf(java.util.Optional.empty());
+        }
+    }
+
+    /**
+     * Load whitelisted stream configuration from another configuration object.
+     *
+     * @param streamConfiguration stream configuration overrides
+     */
+    public void loadStreamConf(java.util.Optional<DistributedLogConfiguration> streamConfiguration) {
         if (!streamConfiguration.isPresent()) {
             return;
         }
diff --git a/distributedlog-core/src/main/java/org/apache/distributedlog/EntryBuffer.java b/distributedlog-core/src/main/java/org/apache/distributedlog/EntryBuffer.java
index a881df8..68d76ea 100644
--- a/distributedlog-core/src/main/java/org/apache/distributedlog/EntryBuffer.java
+++ b/distributedlog-core/src/main/java/org/apache/distributedlog/EntryBuffer.java
@@ -20,7 +20,6 @@ package org.apache.distributedlog;
 import io.netty.buffer.ByteBuf;
 import java.io.IOException;
 import org.apache.distributedlog.exceptions.InvalidEnvelopedEntryException;
-import org.apache.distributedlog.io.TransmitListener;
 
 /**
  * Write representation of a {@link Entry}.
diff --git a/distributedlog-core/src/main/java/org/apache/distributedlog/EnvelopedEntryWriter.java b/distributedlog-core/src/main/java/org/apache/distributedlog/EnvelopedEntryWriter.java
index cc6e941..86cc56e 100644
--- a/distributedlog-core/src/main/java/org/apache/distributedlog/EnvelopedEntryWriter.java
+++ b/distributedlog-core/src/main/java/org/apache/distributedlog/EnvelopedEntryWriter.java
@@ -45,7 +45,7 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 /**
- * {@link org.apache.distributedlog.io.Buffer} based log record set writer.
+ * {@link ByteBuf} based log record set writer.
  */
 class EnvelopedEntryWriter implements Writer {
 
diff --git a/distributedlog-core/src/main/java/org/apache/distributedlog/api/AsyncLogReader.java b/distributedlog-core/src/main/java/org/apache/distributedlog/api/AsyncLogReader.java
index 3838bf7..217236e 100644
--- a/distributedlog-core/src/main/java/org/apache/distributedlog/api/AsyncLogReader.java
+++ b/distributedlog-core/src/main/java/org/apache/distributedlog/api/AsyncLogReader.java
@@ -20,9 +20,13 @@ package org.apache.distributedlog.api;
 import java.util.List;
 import java.util.concurrent.CompletableFuture;
 import java.util.concurrent.TimeUnit;
+import org.apache.bookkeeper.common.annotation.InterfaceAudience.Public;
+import org.apache.bookkeeper.common.annotation.InterfaceStability.Evolving;
 import org.apache.distributedlog.LogRecordWithDLSN;
 import org.apache.distributedlog.io.AsyncCloseable;
 
+@Public
+@Evolving
 public interface AsyncLogReader extends AsyncCloseable {
 
     /**
diff --git a/distributedlog-core/src/main/java/org/apache/distributedlog/api/AsyncLogWriter.java b/distributedlog-core/src/main/java/org/apache/distributedlog/api/AsyncLogWriter.java
index 9e12de2..8bb45a2 100644
--- a/distributedlog-core/src/main/java/org/apache/distributedlog/api/AsyncLogWriter.java
+++ b/distributedlog-core/src/main/java/org/apache/distributedlog/api/AsyncLogWriter.java
@@ -19,11 +19,15 @@ package org.apache.distributedlog.api;
 
 import java.util.List;
 import java.util.concurrent.CompletableFuture;
+import org.apache.bookkeeper.common.annotation.InterfaceAudience.Public;
+import org.apache.bookkeeper.common.annotation.InterfaceStability.Evolving;
 import org.apache.distributedlog.DLSN;
 import org.apache.distributedlog.LogRecord;
 import org.apache.distributedlog.io.AsyncAbortable;
 import org.apache.distributedlog.io.AsyncCloseable;
 
+@Public
+@Evolving
 public interface AsyncLogWriter extends AsyncCloseable, AsyncAbortable {
 
     /**
@@ -31,7 +35,7 @@ public interface AsyncLogWriter extends AsyncCloseable, AsyncAbortable {
      *
      * @return last committed transaction id.
      */
-    public long getLastTxId();
+    long getLastTxId();
 
     /**
      * Write a log record to the stream.
@@ -40,7 +44,7 @@ public interface AsyncLogWriter extends AsyncCloseable, AsyncAbortable {
      * @return A Future which contains a DLSN if the record was successfully written
      * or an exception if the write fails
      */
-    public CompletableFuture<DLSN> write(LogRecord record);
+    CompletableFuture<DLSN> write(LogRecord record);
 
     /**
      * Write log records to the stream in bulk. Each future in the list represents the result of
@@ -51,7 +55,7 @@ public interface AsyncLogWriter extends AsyncCloseable, AsyncAbortable {
      * @return A Future which contains a list of Future DLSNs if the record was successfully written
      * or an exception if the operation fails.
      */
-    public CompletableFuture<List<CompletableFuture<DLSN>>> writeBulk(List<LogRecord> record);
+    CompletableFuture<List<CompletableFuture<DLSN>>> writeBulk(List<LogRecord> record);
 
     /**
      * Truncate the log until <i>dlsn</i>.
@@ -61,10 +65,18 @@ public interface AsyncLogWriter extends AsyncCloseable, AsyncAbortable {
      * @return A Future indicates whether the operation succeeds or not, or an exception
      * if the truncation fails.
      */
-    public CompletableFuture<Boolean> truncate(DLSN dlsn);
+    CompletableFuture<Boolean> truncate(DLSN dlsn);
+
+    /**
+     * Seal the log stream.
+     *
+     * @return a future indicates whether the stream is sealed or not. The final transaction id is returned
+     *         if the stream is sealed, otherwise an exception is returned.
+     */
+    CompletableFuture<Long> markEndOfStream();
 
     /**
      * Get the name of the stream this writer writes data to
      */
-    public String getStreamName();
+    String getStreamName();
 }
diff --git a/distributedlog-core/src/main/java/org/apache/distributedlog/api/DistributedLogManager.java b/distributedlog-core/src/main/java/org/apache/distributedlog/api/DistributedLogManager.java
index 60f629d..46f8b35 100644
--- a/distributedlog-core/src/main/java/org/apache/distributedlog/api/DistributedLogManager.java
+++ b/distributedlog-core/src/main/java/org/apache/distributedlog/api/DistributedLogManager.java
@@ -21,6 +21,8 @@ import java.io.Closeable;
 import java.io.IOException;
 import java.util.List;
 import java.util.concurrent.CompletableFuture;
+import org.apache.bookkeeper.common.annotation.InterfaceAudience.Public;
+import org.apache.bookkeeper.common.annotation.InterfaceStability.Evolving;
 import org.apache.distributedlog.AppendOnlyStreamReader;
 import org.apache.distributedlog.AppendOnlyStreamWriter;
 import org.apache.distributedlog.DLSN;
@@ -38,6 +40,8 @@ import org.apache.distributedlog.api.subscription.SubscriptionsStore;
  * each conceptual place of storage corresponds to exactly one instance of
  * this class, which is created when the EditLog is first opened.
  */
+@Public
+@Evolving
 public interface DistributedLogManager extends AsyncCloseable, Closeable {
 
     /**
@@ -53,6 +57,10 @@ public interface DistributedLogManager extends AsyncCloseable, Closeable {
      */
     public NamespaceDriver getNamespaceDriver();
 
+    //
+    // Log Segment Related Operations
+    //
+
     /**
      * Get log segments.
      *
@@ -77,6 +85,10 @@ public interface DistributedLogManager extends AsyncCloseable, Closeable {
      */
     public void unregisterListener(LogSegmentListener listener);
 
+    //
+    // Writer & Reader Operations
+    //
+
     /**
      * Open async log writer to write records to the log stream.
      *
@@ -85,9 +97,18 @@ public interface DistributedLogManager extends AsyncCloseable, Closeable {
     public CompletableFuture<AsyncLogWriter> openAsyncLogWriter();
 
     /**
+     * Open sync log writer to write records to the log stream.
+     *
+     * @return sync log writer
+     * @throws IOException when fails to open a sync log writer.
+     */
+    public LogWriter openLogWriter() throws IOException;
+
+    /**
      * Begin writing to the log stream identified by the name
      *
      * @return the writer interface to generate log records
+     * @Deprecated since 0.5.0, in favor of using {@link #openLogWriter()}
      */
     public LogWriter startLogSegmentNonPartitioned() throws IOException;
 
@@ -95,23 +116,45 @@ public interface DistributedLogManager extends AsyncCloseable, Closeable {
      * Begin writing to the log stream identified by the name
      *
      * @return the writer interface to generate log records
+     * @Deprecated since 0.5.0, in favor of using {@link #openAsyncLogWriter()}
      */
-    // @Deprecated
     public AsyncLogWriter startAsyncLogSegmentNonPartitioned() throws IOException;
 
     /**
-     * Begin appending to the end of the log stream which is being treated as a sequence of bytes
+     * Open an sync log reader to read records from a log starting from <code>fromTxnId</code>.
      *
-     * @return the writer interface to generate log records
+     * @param fromTxnId
+     *          transaction id to start reading from
+     * @return sync log reader
      */
-    public AppendOnlyStreamWriter getAppendOnlyStreamWriter() throws IOException;
+    public LogReader openLogReader(long fromTxnId) throws IOException;
 
     /**
-     * Get a reader to read a log stream as a sequence of bytes
+     * Open an async log reader to read records from a log starting from <code>fromDLSN</code>
      *
-     * @return the writer interface to generate log records
+     * @param fromDLSN
+     *          dlsn to start reading from
+     * @return async log reader
      */
-    public AppendOnlyStreamReader getAppendOnlyStreamReader() throws IOException;
+    public LogReader openLogReader(DLSN fromDLSN) throws IOException;
+
+    /**
+     * Open an async log reader to read records from a log starting from <code>fromTxnId</code>.
+     *
+     * @param fromTxnId
+     *          transaction id to start reading from
+     * @return async log reader
+     */
+    public CompletableFuture<AsyncLogReader> openAsyncLogReader(long fromTxnId);
+
+    /**
+     * Open an async log reader to read records from a log starting from <code>fromDLSN</code>
+     *
+     * @param fromDLSN
+     *          dlsn to start reading from
+     * @return async log reader
+     */
+    public CompletableFuture<AsyncLogReader> openAsyncLogReader(DLSN fromDLSN);
 
     /**
      * Get the input stream starting with fromTxnId for the specified log
@@ -119,41 +162,61 @@ public interface DistributedLogManager extends AsyncCloseable, Closeable {
      * @param fromTxnId - the first transaction id we want to read
      * @return the stream starting with transaction fromTxnId
      * @throws IOException if a stream cannot be found.
+     * @Deprecated since 0.5.0, in favor of using {@link #openLogReader(long)}
      */
     public LogReader getInputStream(long fromTxnId)
         throws IOException;
 
+    /**
+     * Get the input stream starting with fromTxnId for the specified log
+     *
+     * @param fromDLSN - the first DLSN we want to read
+     * @return the stream starting with DLSN
+     * @throws IOException if a stream cannot be found.
+     * @Deprecated since 0.5.0, in favor of using {@link #openLogReader(DLSN)}
+     */
     public LogReader getInputStream(DLSN fromDLSN) throws IOException;
 
     /**
-     * Open an async log reader to read records from a log starting from <code>fromTxnId</code>.
+     * Get an async log reader to read records from a log starting from <code>fromTxnId</code>.
      *
      * @param fromTxnId
      *          transaction id to start reading from
      * @return async log reader
+     * @throws IOException when fails to open an async log reader.
+     * @see #openAsyncLogReader(long)
+     * @Deprecated it is deprecated since 0.5.0, in favor of using {@link #openAsyncLogReader(long)}
      */
-    public CompletableFuture<AsyncLogReader> openAsyncLogReader(long fromTxnId);
+    public AsyncLogReader getAsyncLogReader(long fromTxnId) throws IOException;
 
     /**
-     * Open an async log reader to read records from a log starting from <code>fromDLSN</code>
+     * Get an async log reader to read records from a log starting from <code>fromDLSN</code>.
      *
      * @param fromDLSN
      *          dlsn to start reading from
      * @return async log reader
+     * @throws IOException when fails to open an async log reader.
+     * @see #openAsyncLogReader(DLSN)
+     * @Deprecated it is deprecated since 0.5.0, in favor of using {@link #openAsyncLogReader(DLSN)}
      */
-    public CompletableFuture<AsyncLogReader> openAsyncLogReader(DLSN fromDLSN);
-
-    // @Deprecated
-    public AsyncLogReader getAsyncLogReader(long fromTxnId) throws IOException;
-
-    // @Deprecated
     public AsyncLogReader getAsyncLogReader(DLSN fromDLSN) throws IOException;
 
+    /**
+     * Get a log reader with lock starting from <i>fromDLSN</i>.
+     *
+     * <p>If two readers tried to open using same subscriberId, one would succeed, while the other
+     * will be blocked until it gets the lock.
+     *
+     * @param fromDLSN
+     *          start dlsn
+     * @return async log reader
+     */
     public CompletableFuture<AsyncLogReader> getAsyncLogReaderWithLock(DLSN fromDLSN);
 
     /**
      * Get a log reader with lock starting from <i>fromDLSN</i> and using <i>subscriberId</i>.
-     * If two readers tried to open using same subscriberId, one would succeed, while the other
+     *
+     * <p>If two readers tried to open using same subscriberId, one would succeed, while the other
      * will be blocked until it gets the lock.
      *
      * @param fromDLSN
@@ -169,7 +232,7 @@ public interface DistributedLogManager extends AsyncCloseable, Closeable {
      * its last commit position recorded in subscription store. If no last commit position found
      * in subscription store, it would start reading from head of the stream.
      *
-     * If the two readers tried to open using same subscriberId, one would succeed, while the other
+     * <p>If the two readers tried to open using same subscriberId, one would succeed, while the other
      * will be blocked until it gets the lock.
      *
      * @param subscriberId
@@ -178,6 +241,33 @@ public interface DistributedLogManager extends AsyncCloseable, Closeable {
      */
     public CompletableFuture<AsyncLogReader> getAsyncLogReaderWithLock(String subscriberId);
 
+    //
+    // Stream writer and reader
+    //
+
+    /**
+     * Begin appending to the end of the log stream which is being treated as a sequence of bytes
+     *
+     * @return the writer interface to generate log records
+     */
+    public AppendOnlyStreamWriter getAppendOnlyStreamWriter() throws IOException;
+
+    /**
+     * Get a reader to read a log stream as a sequence of bytes
+     *
+     * @return the writer interface to generate log records
+     */
+    public AppendOnlyStreamReader getAppendOnlyStreamReader() throws IOException;
+
+    //
+    // Metadata Operations:
+    //
+    // - retrieve head or tail records
+    // - get log record count
+    // - delete logs
+    // - recover logs
+    //
+
     /**
      * Get the {@link DLSN} of first log record whose transaction id is not less than <code>transactionId</code>.
      *
@@ -197,6 +287,13 @@ public interface DistributedLogManager extends AsyncCloseable, Closeable {
         throws IOException;
 
     /**
+     * Get Latest log record with DLSN in the log - async
+     *
+     * @return latest log record with DLSN
+     */
+    public CompletableFuture<LogRecordWithDLSN> getLastLogRecordAsync();
+
+    /**
      * Get the earliest Transaction Id available in the log
      *
      * @return earliest transaction id
@@ -213,21 +310,6 @@ public interface DistributedLogManager extends AsyncCloseable, Closeable {
     public long getLastTxId() throws IOException;
 
     /**
-     * Get Latest DLSN in the log
-     *
-     * @return last dlsn
-     * @throws IOException
-     */
-    public DLSN getLastDLSN() throws IOException;
-
-    /**
-     * Get Latest log record with DLSN in the log - async
-     *
-     * @return latest log record with DLSN
-     */
-    public CompletableFuture<LogRecordWithDLSN> getLastLogRecordAsync();
-
-    /**
      * Get Latest Transaction Id in the log - async
      *
      * @return latest transaction id
@@ -242,6 +324,14 @@ public interface DistributedLogManager extends AsyncCloseable, Closeable {
     public CompletableFuture<DLSN> getFirstDLSNAsync();
 
     /**
+     * Get Latest DLSN in the log
+     *
+     * @return last dlsn
+     * @throws IOException
+     */
+    public DLSN getLastDLSN() throws IOException;
+
+    /**
      * Get Latest DLSN in the log - async
      *
      * @return latest transaction id
@@ -286,6 +376,8 @@ public interface DistributedLogManager extends AsyncCloseable, Closeable {
      * Delete the log.
      *
      * @throws IOException if the deletion fails
+     * @Deprecated since 0.5.0, in favor of using
+     *             {@link org.apache.distributedlog.api.namespace.Namespace#deleteLog(String)}
      */
     public void delete() throws IOException;
 
diff --git a/distributedlog-core/src/main/java/org/apache/distributedlog/api/LogReader.java b/distributedlog-core/src/main/java/org/apache/distributedlog/api/LogReader.java
index 631a8a9..eb1ef9c 100644
--- a/distributedlog-core/src/main/java/org/apache/distributedlog/api/LogReader.java
+++ b/distributedlog-core/src/main/java/org/apache/distributedlog/api/LogReader.java
@@ -17,15 +17,16 @@
  */
 package org.apache.distributedlog.api;
 
+import java.io.Closeable;
+import java.io.IOException;
+import java.util.List;
+import org.apache.bookkeeper.common.annotation.InterfaceAudience.Public;
+import org.apache.bookkeeper.common.annotation.InterfaceStability.Evolving;
 import org.apache.distributedlog.DLSN;
 import org.apache.distributedlog.DistributedLogConfiguration;
 import org.apache.distributedlog.LogRecordWithDLSN;
 import org.apache.distributedlog.io.AsyncCloseable;
 
-import java.io.Closeable;
-import java.io.IOException;
-import java.util.List;
-
 /**
  * <i>LogReader</i> is a `synchronous` reader reading records from a DL log.
  *
@@ -163,6 +164,8 @@ import java.util.List;
  *
  * @see AsyncLogReader
  */
+@Public
+@Evolving
 public interface LogReader extends Closeable, AsyncCloseable {
 
     /**
diff --git a/distributedlog-core/src/main/java/org/apache/distributedlog/api/LogWriter.java b/distributedlog-core/src/main/java/org/apache/distributedlog/api/LogWriter.java
index 46ad1f0..e72b368 100644
--- a/distributedlog-core/src/main/java/org/apache/distributedlog/api/LogWriter.java
+++ b/distributedlog-core/src/main/java/org/apache/distributedlog/api/LogWriter.java
@@ -17,17 +17,20 @@
  */
 package org.apache.distributedlog.api;
 
-import org.apache.distributedlog.LogRecord;
-import org.apache.distributedlog.io.Abortable;
-
 import java.io.Closeable;
 import java.io.IOException;
 import java.util.List;
+import org.apache.bookkeeper.common.annotation.InterfaceAudience.Public;
+import org.apache.bookkeeper.common.annotation.InterfaceStability.Evolving;
+import org.apache.distributedlog.LogRecord;
+import org.apache.distributedlog.io.Abortable;
 
 /*
 * A generic interface class to support writing log records into
 * a persistent distributed log.
 */
+@Public
+@Evolving
 public interface LogWriter extends Closeable, Abortable {
     /**
      * Write a log record to the stream.
@@ -52,19 +55,15 @@ public interface LogWriter extends Closeable, Abortable {
      * persistent storage.
      * The transmission is asynchronous and new data can be still written to the
      * stream while flushing is performed.
-     *
-     * TODO: rename this to flush()
      */
-    public long setReadyToFlush() throws IOException;
+    public long flush() throws IOException;
 
     /**
      * Flush and sync all data that is ready to be flush
-     * {@link #setReadyToFlush()} into underlying persistent store.
+     * {@link #flush()} into underlying persistent store.
      * @throws IOException
-     *
-     * TODO: rename this to commit()
      */
-    public long flushAndSync() throws IOException;
+    public long commit() throws IOException;
 
     /**
      * Flushes all the data up to this point,
diff --git a/distributedlog-core/src/main/java/org/apache/distributedlog/api/MetadataAccessor.java b/distributedlog-core/src/main/java/org/apache/distributedlog/api/MetadataAccessor.java
index 76ef700..d73c99b 100644
--- a/distributedlog-core/src/main/java/org/apache/distributedlog/api/MetadataAccessor.java
+++ b/distributedlog-core/src/main/java/org/apache/distributedlog/api/MetadataAccessor.java
@@ -17,11 +17,20 @@
  */
 package org.apache.distributedlog.api;
 
-import org.apache.distributedlog.io.AsyncCloseable;
-
 import java.io.Closeable;
 import java.io.IOException;
+import org.apache.bookkeeper.common.annotation.InterfaceAudience.LimitedPrivate;
+import org.apache.bookkeeper.common.annotation.InterfaceStability.Evolving;
+import org.apache.distributedlog.io.AsyncCloseable;
 
+/**
+ * Provide a metadata accessor to access customized metadata associated with logs.
+ *
+ * @Deprecated this class is here for legacy reason. It is not recommended to use this class for storing customized
+ *             metadata.
+ */
+@LimitedPrivate
+@Evolving
 public interface MetadataAccessor extends Closeable, AsyncCloseable {
     /**
      * Get the name of the stream managed by this log manager
diff --git a/distributedlog-core/src/main/java/org/apache/distributedlog/api/namespace/Namespace.java b/distributedlog-core/src/main/java/org/apache/distributedlog/api/namespace/Namespace.java
index 818824d..fc3629f 100644
--- a/distributedlog-core/src/main/java/org/apache/distributedlog/api/namespace/Namespace.java
+++ b/distributedlog-core/src/main/java/org/apache/distributedlog/api/namespace/Namespace.java
@@ -17,20 +17,19 @@
  */
 package org.apache.distributedlog.api.namespace;
 
-import com.google.common.annotations.Beta;
-import com.google.common.base.Optional;
+import java.io.IOException;
+import java.util.Iterator;
+import java.util.Optional;
+import org.apache.bookkeeper.common.annotation.InterfaceAudience.Public;
+import org.apache.bookkeeper.common.annotation.InterfaceStability.Evolving;
+import org.apache.bookkeeper.stats.StatsLogger;
 import org.apache.distributedlog.DistributedLogConfiguration;
-import org.apache.distributedlog.api.DistributedLogManager;
-import org.apache.distributedlog.exceptions.LogNotFoundException;
 import org.apache.distributedlog.acl.AccessControlManager;
+import org.apache.distributedlog.api.DistributedLogManager;
 import org.apache.distributedlog.callback.NamespaceListener;
 import org.apache.distributedlog.config.DynamicDistributedLogConfiguration;
+import org.apache.distributedlog.exceptions.LogNotFoundException;
 import org.apache.distributedlog.exceptions.InvalidStreamNameException;
-
-import java.io.IOException;
-import java.util.Iterator;
-
-import org.apache.bookkeeper.stats.StatsLogger;
 import org.apache.distributedlog.namespace.NamespaceDriver;
 
 /**
@@ -68,7 +67,8 @@ import org.apache.distributedlog.namespace.NamespaceDriver;
  * @see DistributedLogManager
  * @since 0.3.32
  */
-@Beta
+@Public
+@Evolving
 public interface Namespace {
 
     /**
diff --git a/distributedlog-core/src/main/java/org/apache/distributedlog/api/namespace/NamespaceBuilder.java b/distributedlog-core/src/main/java/org/apache/distributedlog/api/namespace/NamespaceBuilder.java
index 45dc021..6b01731 100644
--- a/distributedlog-core/src/main/java/org/apache/distributedlog/api/namespace/NamespaceBuilder.java
+++ b/distributedlog-core/src/main/java/org/apache/distributedlog/api/namespace/NamespaceBuilder.java
@@ -18,6 +18,10 @@
 package org.apache.distributedlog.api.namespace;
 
 import com.google.common.base.Preconditions;
+import java.io.IOException;
+import java.net.URI;
+import org.apache.bookkeeper.common.annotation.InterfaceAudience.Public;
+import org.apache.bookkeeper.common.annotation.InterfaceStability.Stable;
 import org.apache.distributedlog.BKDistributedLogNamespace;
 import org.apache.distributedlog.DistributedLogConfiguration;
 import org.apache.distributedlog.DistributedLogConstants;
@@ -40,9 +44,6 @@ import org.apache.bookkeeper.stats.StatsLogger;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import java.io.IOException;
-import java.net.URI;
-
 /**
  * Builder to construct a <code>Namespace</code>.
  * The builder takes the responsibility of loading backend according to the uri.
@@ -50,6 +51,8 @@ import java.net.URI;
  * @see Namespace
  * @since 0.3.32
  */
+@Public
+@Stable
 public class NamespaceBuilder {
 
     private static final Logger logger = LoggerFactory.getLogger(NamespaceBuilder.class);
diff --git a/distributedlog-core/src/test/java/org/apache/distributedlog/TestAsyncReaderWriter.java b/distributedlog-core/src/test/java/org/apache/distributedlog/TestAsyncReaderWriter.java
index 781e8d0..c1181e8 100644
--- a/distributedlog-core/src/test/java/org/apache/distributedlog/TestAsyncReaderWriter.java
+++ b/distributedlog-core/src/test/java/org/apache/distributedlog/TestAsyncReaderWriter.java
@@ -316,12 +316,12 @@ public class TestAsyncReaderWriter extends TestDistributedLogBase {
                 writer.write(DLMTestUtil.getLargeLogRecordInstance(txid++));
             }
             if (j % flushPerNumRecords == 0 ) {
-                writer.setReadyToFlush();
-                writer.flushAndSync();
+                writer.flush();
+                writer.commit();
             }
         }
-        writer.setReadyToFlush();
-        writer.flushAndSync();
+        writer.flush();
+        writer.commit();
         writer.close();
         return txid;
     }
@@ -1384,7 +1384,7 @@ public class TestAsyncReaderWriter extends TestDistributedLogBase {
                                 for (int iter = 1; iter <= (2 * idleReaderErrorThreshold / threadSleepTime) ; iter++) {
                                     Thread.sleep(threadSleepTime);
                                     writer.write(DLMTestUtil.getLargeLogRecordInstance(txid, true));
-                                    writer.setReadyToFlush();
+                                    writer.flush();
                                 }
                                 Thread.sleep(threadSleepTime);
                             }
@@ -1994,9 +1994,9 @@ public class TestAsyncReaderWriter extends TestDistributedLogBase {
         // use customized configuration
         dlm = namespace.openLog(
                 name + "-custom",
-                Optional.<DistributedLogConfiguration>absent(),
-                Optional.of(dynConf),
-                Optional.<StatsLogger>absent());
+                java.util.Optional.empty(),
+                java.util.Optional.of(dynConf),
+                java.util.Optional.empty());
         writer = dlm.startAsyncLogSegmentNonPartitioned();
         Utils.ioResult(writer.write(DLMTestUtil.getLogRecordInstance(1L)));
         segments = dlm.getLogSegments();
diff --git a/distributedlog-core/src/test/java/org/apache/distributedlog/TestBKDistributedLogManager.java b/distributedlog-core/src/test/java/org/apache/distributedlog/TestBKDistributedLogManager.java
index d353894..5fd8fe3 100644
--- a/distributedlog-core/src/test/java/org/apache/distributedlog/TestBKDistributedLogManager.java
+++ b/distributedlog-core/src/test/java/org/apache/distributedlog/TestBKDistributedLogManager.java
@@ -104,8 +104,8 @@ public class TestBKDistributedLogManager extends TestDistributedLogBase {
         for (long j = 1; j <= DEFAULT_SEGMENT_SIZE / 2; j++) {
             writer.write(DLMTestUtil.getLogRecordInstance(txid++));
         }
-        writer.setReadyToFlush();
-        writer.flushAndSync();
+        writer.flush();
+        writer.commit();
         writer.close();
 
         LogReader reader = dlm.getInputStream(1);
@@ -183,8 +183,8 @@ public class TestBKDistributedLogManager extends TestDistributedLogBase {
             LogRecord op = DLMTestUtil.getLogRecordInstance(txid++);
             out.write(op);
         }
-        out.setReadyToFlush();
-        out.flushAndSync();
+        out.flush();
+        out.commit();
         out.close();
         dlm.close();
 
@@ -326,8 +326,8 @@ public class TestBKDistributedLogManager extends TestDistributedLogBase {
             LogRecord op = DLMTestUtil.getLogRecordInstance(txid++);
             out.write(op);
         }
-        out.setReadyToFlush();
-        out.flushAndSync();
+        out.flush();
+        out.commit();
         out.close();
 
         long numTrans = DLMTestUtil.getNumberofLogRecords(createNewDLM(conf, name), 1);
@@ -353,8 +353,8 @@ public class TestBKDistributedLogManager extends TestDistributedLogBase {
             LogRecord op = DLMTestUtil.getLogRecordInstance(txid++);
             out.write(op);
         }
-        out.setReadyToFlush();
-        out.flushAndSync();
+        out.flush();
+        out.commit();
         out.close();
         dlm.close();
 
@@ -410,8 +410,8 @@ public class TestBKDistributedLogManager extends TestDistributedLogBase {
             LogRecord op = DLMTestUtil.getLogRecordInstance(txid++);
             out.write(op);
         }
-        out.setReadyToFlush();
-        out.flushAndSync();
+        out.flush();
+        out.commit();
         out.close();
         dlm.close();
 
@@ -461,8 +461,8 @@ public class TestBKDistributedLogManager extends TestDistributedLogBase {
         for (long j = 1; j <= DEFAULT_SEGMENT_SIZE / 2; j++) {
             writer.write(DLMTestUtil.getLogRecordInstance(txid++));
         }
-        writer.setReadyToFlush();
-        writer.flushAndSync();
+        writer.flush();
+        writer.commit();
         writer.close();
         dlm.close();
 
@@ -834,8 +834,8 @@ public class TestBKDistributedLogManager extends TestDistributedLogBase {
         LogRecord op = DLMTestUtil.getLogRecordInstance(txid);
         op.setControl();
         out.write(op);
-        out.setReadyToFlush();
-        out.flushAndSync();
+        out.flush();
+        out.commit();
         out.abort();
         dlm.close();
 
diff --git a/distributedlog-core/src/test/java/org/apache/distributedlog/TestBKDistributedLogNamespace.java b/distributedlog-core/src/test/java/org/apache/distributedlog/TestBKDistributedLogNamespace.java
index 2078a88..ca3e332 100644
--- a/distributedlog-core/src/test/java/org/apache/distributedlog/TestBKDistributedLogNamespace.java
+++ b/distributedlog-core/src/test/java/org/apache/distributedlog/TestBKDistributedLogNamespace.java
@@ -105,7 +105,7 @@ public class TestBKDistributedLogNamespace extends TestDistributedLogBase {
         try {
             writer = dlm.startLogSegmentNonPartitioned();
             writer.write(DLMTestUtil.getLogRecordInstance(1L));
-            writer.flushAndSync();
+            writer.commit();
             fail("Should fail to write data if stream doesn't exist.");
         } catch (IOException ioe) {
             // expected
diff --git a/distributedlog-core/src/test/java/org/apache/distributedlog/TestBKSyncLogReader.java b/distributedlog-core/src/test/java/org/apache/distributedlog/TestBKSyncLogReader.java
index 07f0db5..6b2bfad 100644
--- a/distributedlog-core/src/test/java/org/apache/distributedlog/TestBKSyncLogReader.java
+++ b/distributedlog-core/src/test/java/org/apache/distributedlog/TestBKSyncLogReader.java
@@ -154,8 +154,8 @@ public class TestBKSyncLogReader extends TestDistributedLogBase {
             LogRecord record = DLMTestUtil.getLogRecordInstance(i);
             out.write(record);
         }
-        out.setReadyToFlush();
-        out.flushAndSync();
+        out.flush();
+        out.commit();
 
         logger.info("Write first 10 records");
 
@@ -174,8 +174,8 @@ public class TestBKSyncLogReader extends TestDistributedLogBase {
             LogRecord record = DLMTestUtil.getLogRecordInstance(i);
             out.write(record);
         }
-        out.setReadyToFlush();
-        out.flushAndSync();
+        out.flush();
+        out.commit();
 
         logger.info("Write another 10 records");
 
@@ -222,8 +222,8 @@ public class TestBKSyncLogReader extends TestDistributedLogBase {
             LogRecord record = DLMTestUtil.getLogRecordInstance(i);
             out.write(record);
         }
-        out.setReadyToFlush();
-        out.flushAndSync();
+        out.flush();
+        out.commit();
 
         logger.info("Write first 10 records");
 
@@ -263,8 +263,8 @@ public class TestBKSyncLogReader extends TestDistributedLogBase {
             LogRecord record = DLMTestUtil.getLogRecordInstance(i);
             out.write(record);
         }
-        out.setReadyToFlush();
-        out.flushAndSync();
+        out.flush();
+        out.commit();
         final AtomicLong nextTxId = new AtomicLong(11L);
 
         logger.info("Write first 10 records");
diff --git a/distributedlog-core/src/test/java/org/apache/distributedlog/TestRollLogSegments.java b/distributedlog-core/src/test/java/org/apache/distributedlog/TestRollLogSegments.java
index 0111e4d..7111e07 100644
--- a/distributedlog-core/src/test/java/org/apache/distributedlog/TestRollLogSegments.java
+++ b/distributedlog-core/src/test/java/org/apache/distributedlog/TestRollLogSegments.java
@@ -357,8 +357,8 @@ public class TestRollLogSegments extends TestDistributedLogBase {
         final int numEntries = 5;
         for (int i = 1; i <= numEntries; i++) {
             writer.write(DLMTestUtil.getLogRecordInstance(i));
-            writer.setReadyToFlush();
-            writer.flushAndSync();
+            writer.flush();
+            writer.commit();
         }
 
         BKDistributedLogManager readDLM = (BKDistributedLogManager) createNewDLM(confLocal, name);
@@ -382,13 +382,13 @@ public class TestRollLogSegments extends TestDistributedLogBase {
 
         // write 6th record
         writer.write(DLMTestUtil.getLogRecordInstance(numEntries + 1));
-        writer.setReadyToFlush();
+        writer.flush();
         // Writer moved to lac = 10, while reader knows lac = 9 and moving to wait on 10
         checkAndWaitWriterReaderPosition(perStreamWriter, 10, reader, 10, readLh, 9);
 
         // write records without commit to simulate similar failure cases
         writer.write(DLMTestUtil.getLogRecordInstance(numEntries + 2));
-        writer.setReadyToFlush();
+        writer.flush();
         // Writer moved to lac = 11, while reader knows lac = 10 and moving to wait on 11
         checkAndWaitWriterReaderPosition(perStreamWriter, 11, reader, 11, readLh, 10);
 
@@ -415,8 +415,8 @@ public class TestRollLogSegments extends TestDistributedLogBase {
 
         BKSyncLogWriter anotherWriter = (BKSyncLogWriter) dlm.startLogSegmentNonPartitioned();
         anotherWriter.write(DLMTestUtil.getLogRecordInstance(numEntries + 3));
-        anotherWriter.setReadyToFlush();
-        anotherWriter.flushAndSync();
+        anotherWriter.flush();
+        anotherWriter.commit();
         anotherWriter.closeAndComplete();
 
         for (long i = numEntries + 1; i <= numEntries + 3; i++) {
diff --git a/distributedlog-protocol/pom.xml b/distributedlog-protocol/pom.xml
index 010f5b2..8d869ef 100644
--- a/distributedlog-protocol/pom.xml
+++ b/distributedlog-protocol/pom.xml
@@ -42,11 +42,6 @@
       <version>${netty.version}</version>
     </dependency>
     <dependency>
-      <groupId>net.jpountz.lz4</groupId>
-      <artifactId>lz4</artifactId>
-      <version>${lz4.version}</version>
-    </dependency>
-    <dependency>
       <groupId>junit</groupId>
       <artifactId>junit</artifactId>
       <version>${junit.version}</version>
@@ -112,7 +107,7 @@
         </configuration>
         <executions>
           <execution>
-            <phase>test-compile</phase>
+            <phase>validate</phase>
             <goals>
               <goal>check</goal>
             </goals>
diff --git a/distributedlog-protocol/src/main/java/org/apache/distributedlog/EnvelopedRecordSetWriter.java b/distributedlog-protocol/src/main/java/org/apache/distributedlog/EnvelopedRecordSetWriter.java
index 0bfd06f..ea1824e 100644
--- a/distributedlog-protocol/src/main/java/org/apache/distributedlog/EnvelopedRecordSetWriter.java
+++ b/distributedlog-protocol/src/main/java/org/apache/distributedlog/EnvelopedRecordSetWriter.java
@@ -38,13 +38,12 @@ import java.util.concurrent.CompletableFuture;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.distributedlog.exceptions.LogRecordTooLongException;
 import org.apache.distributedlog.exceptions.WriteException;
-import org.apache.distributedlog.io.Buffer;
 import org.apache.distributedlog.io.CompressionCodec;
 import org.apache.distributedlog.io.CompressionCodec.Type;
 import org.apache.distributedlog.io.CompressionUtils;
 
 /**
- * {@link Buffer} based log record set writer.
+ * {@link ByteBuf} based log record set writer.
  */
 @Slf4j
 class EnvelopedRecordSetWriter implements LogRecordSet.Writer {
diff --git a/distributedlog-protocol/src/main/java/org/apache/distributedlog/LogRecord.java b/distributedlog-protocol/src/main/java/org/apache/distributedlog/LogRecord.java
index 01d9e9b..7a199f6 100644
--- a/distributedlog-protocol/src/main/java/org/apache/distributedlog/LogRecord.java
+++ b/distributedlog-protocol/src/main/java/org/apache/distributedlog/LogRecord.java
@@ -216,6 +216,12 @@ public class LogRecord {
         return ByteBufUtils.getArray(payload);
     }
 
+    /**
+     * Return the payload buf of this log record.
+     *
+     * @return payload buf of this record.
+     * @since 0.5.0
+     */
     public ByteBuf getPayloadBuf() {
         return payload.slice();
     }
diff --git a/distributedlog-protocol/src/main/java/org/apache/distributedlog/io/TransmitListener.java b/distributedlog-protocol/src/main/java/org/apache/distributedlog/TransmitListener.java
similarity index 92%
rename from distributedlog-protocol/src/main/java/org/apache/distributedlog/io/TransmitListener.java
rename to distributedlog-protocol/src/main/java/org/apache/distributedlog/TransmitListener.java
index a8bc112..9786c09 100644
--- a/distributedlog-protocol/src/main/java/org/apache/distributedlog/io/TransmitListener.java
+++ b/distributedlog-protocol/src/main/java/org/apache/distributedlog/TransmitListener.java
@@ -1,4 +1,4 @@
-/**
+/*
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
  * distributed with this work for additional information
@@ -15,14 +15,12 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.distributedlog.io;
-
-import org.apache.distributedlog.DLSN;
+package org.apache.distributedlog;
 
 /**
  * Listener on transmit results.
  */
-public interface TransmitListener {
+interface TransmitListener {
 
     /**
      * Finalize the transmit result and result the last
diff --git a/distributedlog-protocol/src/main/resources/findbugsExclude.xml b/distributedlog-protocol/src/main/resources/findbugsExclude.xml
index 5e1cd0e..959e009 100644
--- a/distributedlog-protocol/src/main/resources/findbugsExclude.xml
+++ b/distributedlog-protocol/src/main/resources/findbugsExclude.xml
@@ -27,10 +27,4 @@
     <Method name="getPayload" />
     <Bug pattern="EI_EXPOSE_REP" />
   </Match>
-  <Match>
-    <!-- it is safe to store external bytes reference here. //-->
-    <Class name="org.apache.distributedlog.io.Buffer" />
-    <Method name="getData" />
-    <Bug pattern="EI_EXPOSE_REP" />
-  </Match>
 </FindBugsFilter>
diff --git a/distributedlog-protocol/src/test/java/org/apache/distributedlog/TestLogRecordSet.java b/distributedlog-protocol/src/test/java/org/apache/distributedlog/TestLogRecordSet.java
index a75f071..0d04fd4 100644
--- a/distributedlog-protocol/src/test/java/org/apache/distributedlog/TestLogRecordSet.java
+++ b/distributedlog-protocol/src/test/java/org/apache/distributedlog/TestLogRecordSet.java
@@ -32,9 +32,9 @@ import java.util.concurrent.CompletableFuture;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.distributedlog.LogRecordSet.Reader;
 import org.apache.distributedlog.LogRecordSet.Writer;
+import org.apache.distributedlog.common.concurrent.FutureUtils;
 import org.apache.distributedlog.exceptions.LogRecordTooLongException;
 import org.apache.distributedlog.io.CompressionCodec.Type;
-import org.apache.distributedlog.common.concurrent.FutureUtils;
 import org.junit.Test;
 
 /**
diff --git a/distributedlog-proxy-client/pom.xml b/distributedlog-proxy-client/pom.xml
index 718be4d..2b3707e 100644
--- a/distributedlog-proxy-client/pom.xml
+++ b/distributedlog-proxy-client/pom.xml
@@ -152,7 +152,7 @@
         </dependencies>
         <configuration>
           <configLocation>distributedlog/checkstyle.xml</configLocation>
-          <suppressionsLocation>distributedlog/suppressions.xml</suppressionsLocation>
+          <suppressionsLocation>distributedlog/suppressions-packages.xml</suppressionsLocation>
           <consoleOutput>true</consoleOutput>
           <failOnViolation>true</failOnViolation>
           <includeResources>false</includeResources>
@@ -160,7 +160,7 @@
         </configuration>
         <executions>
           <execution>
-            <phase>test-compile</phase>
+            <phase>validate</phase>
             <goals>
               <goal>check</goal>
             </goals>
diff --git a/distributedlog-proxy-protocol/pom.xml b/distributedlog-proxy-protocol/pom.xml
index 609be7e..0703129 100644
--- a/distributedlog-proxy-protocol/pom.xml
+++ b/distributedlog-proxy-protocol/pom.xml
@@ -118,7 +118,7 @@
         </configuration>
         <executions>
           <execution>
-            <phase>test-compile</phase>
+            <phase>validate</phase>
             <goals>
               <goal>check</goal>
             </goals>
diff --git a/distributedlog-proxy-protocol/src/main/java/org/apache/distributedlog/protocol/util/ProtocolUtils.java b/distributedlog-proxy-protocol/src/main/java/org/apache/distributedlog/protocol/util/ProtocolUtils.java
index 1768f5c..2bb63c4 100644
--- a/distributedlog-proxy-protocol/src/main/java/org/apache/distributedlog/protocol/util/ProtocolUtils.java
+++ b/distributedlog-proxy-protocol/src/main/java/org/apache/distributedlog/protocol/util/ProtocolUtils.java
@@ -21,8 +21,8 @@ import static com.google.common.base.Charsets.UTF_8;
 
 import io.netty.buffer.ByteBuf;
 import java.nio.ByteBuffer;
-import org.apache.distributedlog.DLSN;
 import java.util.zip.CRC32;
+import org.apache.distributedlog.DLSN;
 import org.apache.distributedlog.exceptions.DLException;
 import org.apache.distributedlog.exceptions.OwnershipAcquireFailedException;
 import org.apache.distributedlog.thrift.service.ResponseHeader;
diff --git a/distributedlog-proxy-server/pom.xml b/distributedlog-proxy-server/pom.xml
index a80a4d2..e22695e 100644
--- a/distributedlog-proxy-server/pom.xml
+++ b/distributedlog-proxy-server/pom.xml
@@ -233,7 +233,7 @@
         </dependencies>
         <configuration>
           <configLocation>distributedlog/checkstyle.xml</configLocation>
-          <suppressionsLocation>distributedlog/suppressions.xml</suppressionsLocation>
+          <suppressionsLocation>distributedlog/suppressions-packages.xml</suppressionsLocation>
           <consoleOutput>true</consoleOutput>
           <failOnViolation>true</failOnViolation>
           <includeResources>false</includeResources>
@@ -241,7 +241,7 @@
         </configuration>
         <executions>
           <execution>
-            <phase>test-compile</phase>
+            <phase>validate</phase>
             <goals>
               <goal>check</goal>
             </goals>
diff --git a/distributedlog-proxy-server/src/main/java/org/apache/distributedlog/service/stream/StreamImpl.java b/distributedlog-proxy-server/src/main/java/org/apache/distributedlog/service/stream/StreamImpl.java
index 71a9531..d7a38c8 100644
--- a/distributedlog-proxy-server/src/main/java/org/apache/distributedlog/service/stream/StreamImpl.java
+++ b/distributedlog-proxy-server/src/main/java/org/apache/distributedlog/service/stream/StreamImpl.java
@@ -246,9 +246,9 @@ public class StreamImpl implements Stream {
     }
 
     private DistributedLogManager openLog(String name) throws IOException {
-        Optional<DistributedLogConfiguration> dlConf = Optional.<DistributedLogConfiguration>absent();
-        Optional<DynamicDistributedLogConfiguration> dynDlConf = Optional.of(dynConf);
-        Optional<StatsLogger> perStreamStatsLogger = Optional.of(streamLogger);
+        java.util.Optional<DistributedLogConfiguration> dlConf = java.util.Optional.empty();
+        java.util.Optional<DynamicDistributedLogConfiguration> dynDlConf = java.util.Optional.of(dynConf);
+        java.util.Optional<StatsLogger> perStreamStatsLogger = java.util.Optional.of(streamLogger);
         return dlNamespace.openLog(name, dlConf, dynDlConf, perStreamStatsLogger);
     }
 
diff --git a/tests/jmh-0.4/pom.xml b/tests/jmh-0.4/pom.xml
index 7e43acb..41719f9 100644
--- a/tests/jmh-0.4/pom.xml
+++ b/tests/jmh-0.4/pom.xml
@@ -99,6 +99,39 @@
         <groupId>org.codehaus.mojo</groupId>
         <artifactId>findbugs-maven-plugin</artifactId>
       </plugin>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-checkstyle-plugin</artifactId>
+        <version>${maven-checkstyle-plugin.version}</version>
+        <dependencies>
+          <dependency>
+            <groupId>com.puppycrawl.tools</groupId>
+            <artifactId>checkstyle</artifactId>
+            <version>${puppycrawl.checkstyle.version}</version>
+          </dependency>
+          <dependency>
+            <groupId>org.apache.distributedlog</groupId>
+            <artifactId>distributedlog-build-tools</artifactId>
+            <version>${project.version}</version>
+          </dependency>
+        </dependencies>
+        <configuration>
+          <configLocation>distributedlog/checkstyle.xml</configLocation>
+          <suppressionsLocation>distributedlog/suppressions.xml</suppressionsLocation>
+          <consoleOutput>true</consoleOutput>
+          <failOnViolation>true</failOnViolation>
+          <includeResources>false</includeResources>
+          <includeTestSourceDirectory>true</includeTestSourceDirectory>
+        </configuration>
+        <executions>
+          <execution>
+            <phase>test-compile</phase>
+            <goals>
+              <goal>check</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>
     </plugins>
   </build>
 </project>
diff --git a/distributedlog-protocol/src/main/java/org/apache/distributedlog/io/Buffer.java b/tests/jmh-0.4/src/main/java/org/apache/distributedlog/tests/package-info.java
similarity index 71%
rename from distributedlog-protocol/src/main/java/org/apache/distributedlog/io/Buffer.java
rename to tests/jmh-0.4/src/main/java/org/apache/distributedlog/tests/package-info.java
index 16718c5..f41b0de 100644
--- a/distributedlog-protocol/src/main/java/org/apache/distributedlog/io/Buffer.java
+++ b/tests/jmh-0.4/src/main/java/org/apache/distributedlog/tests/package-info.java
@@ -1,4 +1,4 @@
-/**
+/*
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
  * distributed with this work for additional information
@@ -15,19 +15,8 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.distributedlog.io;
-
-import java.io.ByteArrayOutputStream;
 
 /**
- * {@link ByteArrayOutputStream} based buffer.
+ * DistributedLog Tests Package.
  */
-public class Buffer extends ByteArrayOutputStream {
-    public Buffer(int initialCapacity) {
-        super(initialCapacity);
-    }
-
-    public byte[] getData() {
-        return buf;
-    }
-}
+package org.apache.distributedlog.tests;
\ No newline at end of file
diff --git a/tests/jmh/pom.xml b/tests/jmh/pom.xml
index ed051d6..b194fe7 100644
--- a/tests/jmh/pom.xml
+++ b/tests/jmh/pom.xml
@@ -99,6 +99,39 @@
         <groupId>org.codehaus.mojo</groupId>
         <artifactId>findbugs-maven-plugin</artifactId>
       </plugin>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-checkstyle-plugin</artifactId>
+        <version>${maven-checkstyle-plugin.version}</version>
+        <dependencies>
+          <dependency>
+            <groupId>com.puppycrawl.tools</groupId>
+            <artifactId>checkstyle</artifactId>
+            <version>${puppycrawl.checkstyle.version}</version>
+          </dependency>
+          <dependency>
+            <groupId>org.apache.distributedlog</groupId>
+            <artifactId>distributedlog-build-tools</artifactId>
+            <version>${project.version}</version>
+          </dependency>
+        </dependencies>
+        <configuration>
+          <configLocation>distributedlog/checkstyle.xml</configLocation>
+          <suppressionsLocation>distributedlog/suppressions.xml</suppressionsLocation>
+          <consoleOutput>true</consoleOutput>
+          <failOnViolation>true</failOnViolation>
+          <includeResources>false</includeResources>
+          <includeTestSourceDirectory>true</includeTestSourceDirectory>
+        </configuration>
+        <executions>
+          <execution>
+            <phase>test-compile</phase>
+            <goals>
+              <goal>check</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>
     </plugins>
   </build>
 </project>
diff --git a/distributedlog-protocol/src/main/java/org/apache/distributedlog/io/package-info.java b/tests/jmh/src/main/java/org/apache/distributedlog/tests/package-info.java
similarity index 89%
rename from distributedlog-protocol/src/main/java/org/apache/distributedlog/io/package-info.java
rename to tests/jmh/src/main/java/org/apache/distributedlog/tests/package-info.java
index 740359b..f41b0de 100644
--- a/distributedlog-protocol/src/main/java/org/apache/distributedlog/io/package-info.java
+++ b/tests/jmh/src/main/java/org/apache/distributedlog/tests/package-info.java
@@ -1,4 +1,4 @@
-/**
+/*
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
  * distributed with this work for additional information
@@ -15,7 +15,8 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
+
 /**
- * I/O related utilities used across the project.
+ * DistributedLog Tests Package.
  */
-package org.apache.distributedlog.io;
+package org.apache.distributedlog.tests;
\ No newline at end of file

-- 
To stop receiving notification emails like this one, please contact
['"distributedlog-commits@bookkeeper.apache.org" <di...@bookkeeper.apache.org>'].