bookkeeper-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From si...@apache.org
Subject [bookkeeper] branch master updated: Add Checkstyle to the build process (Part 1)
Date Mon, 17 Jul 2017 21:00:47 GMT
This is an automated email from the ASF dual-hosted git repository.

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


The following commit(s) were added to refs/heads/master by this push:
     new a84b5e1  Add Checkstyle to the build process (Part 1)
a84b5e1 is described below

commit a84b5e11114c5a6eabeaf17ba60975439593fa2d
Author: sigee <sigee15@gmail.com>
AuthorDate: Mon Jul 17 14:00:39 2017 -0700

    Add Checkstyle to the build process (Part 1)
    
    Add checkstyle to
    - bookkeeper-benchmark
    - Stats API for bookkeeper
    - Stats provider for codahale metrics
    - Stats provider for Prometheus
    - Stats provider for Finagle stats
    - Stats provider for twitter-ostrich package
    - Stats provider for twitter-stats package
    
    and fix issues checkstyle reported.
    
    ---
    Be sure to do all of the following to help us incorporate your contribution
    quickly and easily:
    
    - [X] Make sure the PR title is formatted like:
        `<Issue # or BOOKKEEPER-#>: Description of pull request`
        `e.g. Issue 123: Description ...`
        `e.g. BOOKKEEPER-1234: Description ...`
    - [ ] Make sure tests pass via `mvn clean apache-rat:check install findbugs:check`.
    - [X] Replace `<Issue # or BOOKKEEPER-#>` in the title with the actual Issue/JIRA number.
    
    ---
    
    Author: sigee <sigee15@gmail.com>
    
    Reviewers: Enrico Olivelli <eolivelli@gmail.com>, Jia Zhai <None>, Sijie Guo <sijie@apache.org>
    
    This closes #231 from sigee/checkstyle
---
 bookkeeper-benchmark/pom.xml                       |  28 ++
 .../apache/bookkeeper/benchmark/BenchBookie.java   |  37 +-
 .../benchmark/BenchReadThroughputLatency.java      |   9 +-
 .../benchmark/BenchThroughputLatency.java          |  62 +--
 .../apache/bookkeeper/benchmark/MySqlClient.java   |  27 +-
 .../apache/bookkeeper/benchmark/TestClient.java    |  33 +-
 .../apache/bookkeeper/benchmark/package-info.java  |  23 ++
 .../src/test/resources/log4j.properties            |   8 +-
 .../codahale-metrics-provider/pom.xml              |  32 ++
 .../bookkeeper/stats/CodahaleMetricsProvider.java  |   3 +
 .../bookkeeper/stats/CodahaleOpStatsLogger.java    |  11 +-
 .../bookkeeper/stats/CodahaleStatsLogger.java      |  10 +-
 .../org/apache/bookkeeper/stats/package-info.java  |  30 +-
 .../prometheus-metrics-provider/pom.xml            |  33 ++
 .../apache/bookkeeper/stats/PrometheusCounter.java |   3 +
 .../stats/PrometheusMetricsProvider.java           |   3 +
 .../bookkeeper/stats/PrometheusOpStatsLogger.java  |   3 +
 .../bookkeeper/stats/PrometheusStatsLogger.java    |   3 +
 .../org/apache/bookkeeper/stats/package-info.java  |  30 +-
 .../twitter-finagle-provider/pom.xml               |  32 ++
 .../stats/twitter/finagle/CounterImpl.java         |   2 +-
 .../twitter/finagle/FinagleStatsLoggerImpl.java    |   5 +-
 .../twitter/finagle/FinagleStatsProvider.java      |   4 +-
 .../stats/twitter/finagle/OpStatsLoggerImpl.java   |  10 +-
 .../stats/twitter/finagle/package-info.java        |  13 +-
 .../twitter-ostrich-provider/pom.xml               |  32 ++
 .../stats/twitter/ostrich/CounterImpl.java         |   2 +-
 .../stats/twitter/ostrich/OstrichProvider.java     |  11 +-
 .../stats/twitter/ostrich/package-info.java        |  30 +-
 .../twitter-science-provider/pom.xml               |  32 ++
 .../stats/twitter/science/CounterImpl.java         |   2 +-
 .../stats/twitter/science/HTTPStatsExporter.java   |   8 +-
 .../stats/twitter/science/OpStatsLoggerImpl.java   |  15 +-
 .../twitter/science/TwitterStatsProvider.java      |   7 +-
 .../stats/twitter/science/package-info.java        |  30 +-
 bookkeeper-stats/pom.xml                           |  32 ++
 .../bookkeeper/stats/CachingStatsLogger.java       |   3 +
 .../bookkeeper/stats/CachingStatsProvider.java     |   3 +
 .../java/org/apache/bookkeeper/stats/Counter.java  |  10 +-
 .../java/org/apache/bookkeeper/stats/Gauge.java    |   4 +-
 .../apache/bookkeeper/stats/NullStatsLogger.java   |   3 +
 .../apache/bookkeeper/stats/NullStatsProvider.java |   3 +
 .../org/apache/bookkeeper/stats/OpStatsData.java   |   2 +-
 .../org/apache/bookkeeper/stats/OpStatsLogger.java |  19 +-
 .../java/org/apache/bookkeeper/stats/Stats.java    |   9 +-
 .../org/apache/bookkeeper/stats/StatsLogger.java   |  12 +-
 .../org/apache/bookkeeper/stats/StatsProvider.java |  10 +-
 .../{NullStatsProvider.java => package-info.java}  |  30 +-
 checkstyle.xml                                     | 448 +++++++++++++++++++++
 suppressions.xml                                   |  28 ++
 50 files changed, 953 insertions(+), 286 deletions(-)

diff --git a/bookkeeper-benchmark/pom.xml b/bookkeeper-benchmark/pom.xml
index d849fb2..98ed6d5 100644
--- a/bookkeeper-benchmark/pom.xml
+++ b/bookkeeper-benchmark/pom.xml
@@ -49,6 +49,34 @@
           </systemPropertyVariables>
 	</configuration>
       </plugin>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-checkstyle-plugin</artifactId>
+        <version>2.17</version>
+        <dependencies>
+          <dependency>
+            <groupId>com.puppycrawl.tools</groupId>
+            <artifactId>checkstyle</artifactId>
+            <version>6.19</version>
+          </dependency>
+        </dependencies>
+        <executions>
+          <execution>
+            <id>checkstyle</id>
+            <phase>validate</phase>
+            <goals>
+              <goal>check</goal>
+            </goals>
+            <configuration>
+              <configLocation>../checkstyle.xml</configLocation>
+              <suppressionsLocation>../suppressions.xml</suppressionsLocation>
+              <encoding>UTF-8</encoding>
+              <consoleOutput>true</consoleOutput>
+              <failsOnError>true</failsOnError>
+            </configuration>
+          </execution>
+        </executions>
+      </plugin>
     </plugins>
   </build>
   <dependencies>
diff --git a/bookkeeper-benchmark/src/main/java/org/apache/bookkeeper/benchmark/BenchBookie.java b/bookkeeper-benchmark/src/main/java/org/apache/bookkeeper/benchmark/BenchBookie.java
index 7ccd034..2342704 100644
--- a/bookkeeper-benchmark/src/main/java/org/apache/bookkeeper/benchmark/BenchBookie.java
+++ b/bookkeeper-benchmark/src/main/java/org/apache/bookkeeper/benchmark/BenchBookie.java
@@ -48,13 +48,16 @@ import io.netty.channel.EventLoopGroup;
 import io.netty.channel.epoll.EpollEventLoopGroup;
 import io.netty.channel.nio.NioEventLoopGroup;
 
+/**
+ * @TODO: Write JavaDoc comment {@link https://github.com/apache/bookkepeer/issues/247}
+ */
 public class BenchBookie {
     static final Logger LOG = LoggerFactory.getLogger(BenchBookie.class);
 
     static class LatencyCallback implements WriteCallback {
         boolean complete;
         @Override
-        synchronized public void writeComplete(int rc, long ledgerId, long entryId,
+        public synchronized void writeComplete(int rc, long ledgerId, long entryId,
                 BookieSocketAddress addr, Object ctx) {
             if (rc != 0) {
                 LOG.error("Got error " + rc);
@@ -62,11 +65,11 @@ public class BenchBookie {
             complete = true;
             notifyAll();
         }
-        synchronized public void resetComplete() {
+        public synchronized void resetComplete() {
             complete = false;
         }
-        synchronized public void waitForComplete() throws InterruptedException {
-            while(!complete) {
+        public synchronized void waitForComplete() throws InterruptedException {
+            while (!complete) {
                 wait();
             }
         }
@@ -75,7 +78,7 @@ public class BenchBookie {
     static class ThroughputCallback implements WriteCallback {
         int count;
         int waitingCount = Integer.MAX_VALUE;
-        synchronized public void writeComplete(int rc, long ledgerId, long entryId,
+        public synchronized void writeComplete(int rc, long ledgerId, long entryId,
                 BookieSocketAddress addr, Object ctx) {
             if (rc != 0) {
                 LOG.error("Got error " + rc);
@@ -85,8 +88,8 @@ public class BenchBookie {
                 notifyAll();
             }
         }
-        synchronized public void waitFor(int count) throws InterruptedException {
-            while(this.count < count) {
+        public synchronized void waitFor(int count) throws InterruptedException {
+            while (this.count < count) {
                 waitingCount = count;
                 wait(1000);
             }
@@ -100,14 +103,18 @@ public class BenchBookie {
         LedgerHandle lh = null;
         long id = 0;
         try {
-            bkc =new BookKeeper(zkServers);
+            bkc = new BookKeeper(zkServers);
             lh = bkc.createLedger(1, 1, BookKeeper.DigestType.CRC32,
                                   new byte[20]);
             id = lh.getId();
             return id;
         } finally {
-            if (lh != null) { lh.close(); }
-            if (bkc != null) { bkc.close(); }
+            if (lh != null) {
+                lh.close();
+            }
+            if (bkc != null) {
+                bkc.close();
+            }
         }
     }
     /**
@@ -163,7 +170,7 @@ public class BenchBookie {
         int warmUpCount = 999;
 
         long ledger = getValidLedgerId(servers);
-        for(long entry = 0; entry < warmUpCount; entry++) {
+        for (long entry = 0; entry < warmUpCount; entry++) {
             ByteBuf toSend = Unpooled.buffer(size);
             toSend.resetReaderIndex();
             toSend.resetWriterIndex();
@@ -180,7 +187,7 @@ public class BenchBookie {
         LOG.info("Benchmarking latency");
         int entryCount = 5000;
         long startTime = System.nanoTime();
-        for(long entry = 0; entry < entryCount; entry++) {
+        for (long entry = 0; entry < entryCount; entry++) {
             ByteBuf toSend = Unpooled.buffer(size);
             toSend.resetReaderIndex();
             toSend.resetWriterIndex();
@@ -193,7 +200,7 @@ public class BenchBookie {
             lc.waitForComplete();
         }
         long endTime = System.nanoTime();
-        LOG.info("Latency: " + (((double)(endTime-startTime))/((double)entryCount))/1000000.0);
+        LOG.info("Latency: " + (((double) (endTime - startTime)) / ((double) entryCount)) / 1000000.0);
 
         entryCount = 50000;
 
@@ -201,7 +208,7 @@ public class BenchBookie {
         LOG.info("Benchmarking throughput");
         startTime = System.currentTimeMillis();
         tc = new ThroughputCallback();
-        for(long entry = 0; entry < entryCount; entry++) {
+        for (long entry = 0; entry < entryCount; entry++) {
             ByteBuf toSend = Unpooled.buffer(size);
             toSend.resetReaderIndex();
             toSend.resetWriterIndex();
@@ -213,7 +220,7 @@ public class BenchBookie {
         }
         tc.waitFor(entryCount);
         endTime = System.currentTimeMillis();
-        LOG.info("Throughput: " + ((long)entryCount)*1000/(endTime-startTime));
+        LOG.info("Throughput: " + ((long) entryCount) * 1000 / (endTime - startTime));
 
         bc.close();
         eventLoop.shutdownGracefully();
diff --git a/bookkeeper-benchmark/src/main/java/org/apache/bookkeeper/benchmark/BenchReadThroughputLatency.java b/bookkeeper-benchmark/src/main/java/org/apache/bookkeeper/benchmark/BenchReadThroughputLatency.java
index f04960a..336f07e 100644
--- a/bookkeeper-benchmark/src/main/java/org/apache/bookkeeper/benchmark/BenchReadThroughputLatency.java
+++ b/bookkeeper-benchmark/src/main/java/org/apache/bookkeeper/benchmark/BenchReadThroughputLatency.java
@@ -47,6 +47,9 @@ import java.util.concurrent.atomic.AtomicInteger;
 
 import static com.google.common.base.Charsets.UTF_8;
 
+/**
+ * @TODO: Write JavaDoc comment {@link https://github.com/apache/bookkepeer/issues/247}
+ */
 public class BenchReadThroughputLatency {
     static final Logger LOG = LoggerFactory.getLogger(BenchReadThroughputLatency.class);
 
@@ -101,7 +104,7 @@ public class BenchReadThroughputLatency {
                 while (lastRead < lastConfirmed) {
                     long nextLimit = lastRead + 100000;
                     long readTo = Math.min(nextLimit, lastConfirmed);
-                    Enumeration<LedgerEntry> entries = lh.readEntries(lastRead+1, readTo);
+                    Enumeration<LedgerEntry> entries = lh.readEntries(lastRead + 1, readTo);
                     lastRead = readTo;
                     while (entries.hasMoreElements()) {
                         LedgerEntry e = entries.nextElement();
@@ -120,10 +123,10 @@ public class BenchReadThroughputLatency {
             }
         } catch (InterruptedException ie) {
             // ignore
-        } catch (Exception e ) {
+        } catch (Exception e) {
             LOG.error("Exception in reader", e);
         } finally {
-            LOG.info("Read {} in {}ms", entriesRead, time/1000/1000);
+            LOG.info("Read {} in {}ms", entriesRead, time / 1000 / 1000);
 
             try {
                 if (lh != null) {
diff --git a/bookkeeper-benchmark/src/main/java/org/apache/bookkeeper/benchmark/BenchThroughputLatency.java b/bookkeeper-benchmark/src/main/java/org/apache/bookkeeper/benchmark/BenchThroughputLatency.java
index 71e76b6..874a26a 100644
--- a/bookkeeper-benchmark/src/main/java/org/apache/bookkeeper/benchmark/BenchThroughputLatency.java
+++ b/bookkeeper-benchmark/src/main/java/org/apache/bookkeeper/benchmark/BenchThroughputLatency.java
@@ -56,6 +56,9 @@ import org.slf4j.LoggerFactory;
 
 import static com.google.common.base.Charsets.UTF_8;
 
+/**
+ * @TODO: Write JavaDoc comment {@link https://github.com/apache/bookkepeer/issues/247}
+ */
 public class BenchThroughputLatency implements AddCallback, Runnable {
     static final Logger LOG = LoggerFactory.getLogger(BenchThroughputLatency.class);
 
@@ -87,10 +90,10 @@ public class BenchThroughputLatency implements AddCallback, Runnable {
         this.numberOfLedgers = numberOfLedgers;
         this.sendLimit = sendLimit;
         this.latencies = new long[sendLimit];
-        try{
+        try {
             lh = new LedgerHandle[this.numberOfLedgers];
 
-            for(int i = 0; i < this.numberOfLedgers; i++) {
+            for (int i = 0; i < this.numberOfLedgers; i++) {
                 lh[i] = bk.createLedger(ensemble, writeQuorumSize,
                                         ackQuorumSize,
                                         BookKeeper.DigestType.CRC32,
@@ -104,7 +107,7 @@ public class BenchThroughputLatency implements AddCallback, Runnable {
 
     Random rand = new Random();
     public void close() throws InterruptedException, BKException {
-        for(int i = 0; i < numberOfLedgers; i++) {
+        for (int i = 0; i < numberOfLedgers; i++) {
             lh[i].close();
         }
         bk.close();
@@ -126,7 +129,7 @@ public class BenchThroughputLatency implements AddCallback, Runnable {
     AtomicLong completedRequests = new AtomicLong(0);
 
     long duration = -1;
-    synchronized public long getDuration() {
+    public synchronized long getDuration() {
         return duration;
     }
 
@@ -139,7 +142,7 @@ public class BenchThroughputLatency implements AddCallback, Runnable {
         Thread reporter = new Thread() {
                 public void run() {
                     try {
-                        while(true) {
+                        while (true) {
                             Thread.sleep(1000);
                             LOG.info("ms: {} req: {}", System.currentTimeMillis(), completedRequests.getAndSet(0));
                         }
@@ -151,14 +154,13 @@ public class BenchThroughputLatency implements AddCallback, Runnable {
         reporter.start();
         long beforeSend = System.nanoTime();
 
-        while(!Thread.currentThread().isInterrupted() && sent < sendLimit) {
+        while (!Thread.currentThread().isInterrupted() && sent < sendLimit) {
             try {
                 sem.acquire();
                 if (sent == 10000) {
                     long afterSend = System.nanoTime();
                     long time = afterSend - beforeSend;
-                    LOG.info("Time to send first batch: {}s {}ns ",
-                             time/1000/1000/1000, time);
+                    LOG.info("Time to send first batch: {}s {}ns ", time / 1000 / 1000 / 1000, time);
                 }
             } catch (InterruptedException e) {
                 break;
@@ -178,20 +180,20 @@ public class BenchThroughputLatency implements AddCallback, Runnable {
         LOG.info("Sent: "  + sent);
         try {
             int i = 0;
-            while(this.counter.get() > 0) {
+            while (this.counter.get() > 0) {
                 Thread.sleep(1000);
                 i++;
                 if (i > 30) {
                     break;
                 }
             }
-        } catch(InterruptedException e) {
+        } catch (InterruptedException e) {
             LOG.error("Interrupted while waiting", e);
         }
-        synchronized(this) {
+        synchronized (this) {
             duration = System.currentTimeMillis() - start;
         }
-        throughput = sent*1000/getDuration();
+        throughput = sent * 1000 / getDuration();
 
         reporter.interrupt();
         try {
@@ -223,7 +225,7 @@ public class BenchThroughputLatency implements AddCallback, Runnable {
         counter.decrementAndGet();
 
         if (rc == 0) {
-            latencies[(int)entryId] = newTime;
+            latencies[(int) entryId] = newTime;
             completedRequests.incrementAndGet();
         }
     }
@@ -291,21 +293,21 @@ public class BenchThroughputLatency implements AddCallback, Runnable {
                 }, timeout);
         }
 
-        LOG.warn("(Parameters received) running time: " + runningTime +
-                ", entry size: " + entrysize + ", ensemble size: " + ensemble +
-                ", quorum size: " + quorum +
-                ", throttle: " + throttle +
-                ", number of ledgers: " + ledgers +
-                ", zk servers: " + servers +
-                ", latency file: " + latencyFile);
+        LOG.warn("(Parameters received) running time: " + runningTime
+                + ", entry size: " + entrysize + ", ensemble size: " + ensemble
+                + ", quorum size: " + quorum
+                + ", throttle: " + throttle
+                + ", number of ledgers: " + ledgers
+                + ", zk servers: " + servers
+                + ", latency file: " + latencyFile);
 
-        long totalTime = runningTime*1000;
+        long totalTime = runningTime * 1000;
 
         // Do a warmup run
         Thread thread;
 
         byte data[] = new byte[entrysize];
-        Arrays.fill(data, (byte)'x');
+        Arrays.fill(data, (byte) 'x');
 
         ClientConfiguration conf = new ClientConfiguration();
         conf.setThrottleValue(throttle).setReadTimeout(sockTimeout).setZkServers(servers);
@@ -364,7 +366,7 @@ public class BenchThroughputLatency implements AddCallback, Runnable {
         LOG.info("Calculating percentiles");
 
         int numlat = 0;
-        for(int i = 0; i < bench.latencies.length; i++) {
+        for (int i = 0; i < bench.latencies.length; i++) {
             if (bench.latencies[i] > 0) {
                 numlat++;
             }
@@ -372,15 +374,15 @@ public class BenchThroughputLatency implements AddCallback, Runnable {
         int numcompletions = numlat;
         numlat = Math.min(bench.sendLimit, numlat);
         long[] latency = new long[numlat];
-        int j =0;
-        for(int i = 0; i < bench.latencies.length && j < numlat; i++) {
+        int j = 0;
+        for (int i = 0; i < bench.latencies.length && j < numlat; i++) {
             if (bench.latencies[i] > 0) {
                 latency[j++] = bench.latencies[i];
             }
         }
         Arrays.sort(latency);
 
-        long tp = (long)((double)(numcompletions*1000.0)/(double)bench.getDuration());
+        long tp = (long) ((double) (numcompletions * 1000.0) / (double) bench.getDuration());
 
         LOG.info(numcompletions + " completions in " + bench.getDuration() + " milliseconds: " + tp + " ops/sec");
 
@@ -394,8 +396,8 @@ public class BenchThroughputLatency implements AddCallback, Runnable {
         // dump the latencies for later debugging (it will be sorted by entryid)
         OutputStream fos = new BufferedOutputStream(new FileOutputStream(latencyFile));
 
-        for(Long l: latency) {
-            fos.write((Long.toString(l)+"\t"+(l/1000000)+ "ms\n").getBytes(UTF_8));
+        for (Long l: latency) {
+            fos.write((Long.toString(l) + "\t" + (l / 1000000) + "ms\n").getBytes(UTF_8));
         }
         fos.flush();
         fos.close();
@@ -413,11 +415,11 @@ public class BenchThroughputLatency implements AddCallback, Runnable {
         int sampleSize = (size * percentile) / 100;
         long total = 0;
         int count = 0;
-        for(int i = 0; i < sampleSize; i++) {
+        for (int i = 0; i < sampleSize; i++) {
             total += latency[i];
             count++;
         }
-        return ((double)total/(double)count)/1000000.0;
+        return ((double) total / (double) count) / 1000000.0;
     }
 
     private static long warmUp(byte[] data, int ledgers, int ensemble, int qSize,
diff --git a/bookkeeper-benchmark/src/main/java/org/apache/bookkeeper/benchmark/MySqlClient.java b/bookkeeper-benchmark/src/main/java/org/apache/bookkeeper/benchmark/MySqlClient.java
index ebea877..f04a997 100644
--- a/bookkeeper-benchmark/src/main/java/org/apache/bookkeeper/benchmark/MySqlClient.java
+++ b/bookkeeper-benchmark/src/main/java/org/apache/bookkeeper/benchmark/MySqlClient.java
@@ -34,6 +34,9 @@ import static com.google.common.base.Charsets.UTF_8;
 
 import org.apache.zookeeper.KeeperException;
 
+/**
+ * @TODO: Write JavaDoc comment {@link https://github.com/apache/bookkepeer/issues/247}
+ */
 public class MySqlClient {
     static final Logger LOG = LoggerFactory.getLogger(MySqlClient.class);
 
@@ -73,12 +76,13 @@ public class MySqlClient {
     public void closeHandle() throws KeeperException, InterruptedException, SQLException {
         con.close();
     }
+
     /**
-     * First parameter is an integer defining the length of the message
-     * Second parameter is the number of writes
-     * Third parameter is host:port
-     * Fourth parameter is username
-     * Fifth parameter is password
+     * First parameter is an integer defining the length of the message.
+     * Second parameter is the number of writes.
+     * Third parameter is host:port.
+     * Fourth parameter is username.
+     * Fifth parameter is password.
      * @param args
      * @throws ClassNotFoundException
      * @throws SQLException
@@ -86,7 +90,7 @@ public class MySqlClient {
     public static void main(String[] args) throws ClassNotFoundException, SQLException {
         int lenght = Integer.parseInt(args[1]);
         StringBuilder sb = new StringBuilder();
-        while(lenght-- > 0) {
+        while (lenght-- > 0) {
             sb.append('a');
         }
         try {
@@ -105,15 +109,16 @@ public class MySqlClient {
     }
 
     /**
-     * 	Adds  data entry to the DB
-     * 	@param data 	the entry to be written, given as a byte array
-     * 	@param times	the number of times the entry should be written on the DB	*/
+     * Adds data entry to the DB.
+     * @param data the entry to be written, given as a byte array
+     * @param times the number of times the entry should be written on the DB
+     */
     void writeSameEntryBatch(byte[] data, int times) throws InterruptedException, SQLException {
         start = System.currentTimeMillis();
         int count = times;
         String content = new String(data, UTF_8);
         System.out.println("Data: " + content + ", " + data.length);
-        while(count-- > 0) {
+        while (count-- > 0) {
             stmt.addBatch("insert into data(content) values(\"" + content + "\");");
         }
         LOG.info("Finished writing batch SQL command in ms: " + (System.currentTimeMillis() - start));
@@ -128,7 +133,7 @@ public class MySqlClient {
         int count = times;
         String content = new String(data, UTF_8);
         System.out.println("Data: " + content + ", " + data.length);
-        while(count-- > 0) {
+        while (count-- > 0) {
             stmt.executeUpdate("insert into data(content) values(\"" + content + "\");");
         }
         System.out.println("Finished " + times + " writes in ms: " + (System.currentTimeMillis() - start));
diff --git a/bookkeeper-benchmark/src/main/java/org/apache/bookkeeper/benchmark/TestClient.java b/bookkeeper-benchmark/src/main/java/org/apache/bookkeeper/benchmark/TestClient.java
index a974553..747c41a 100644
--- a/bookkeeper-benchmark/src/main/java/org/apache/bookkeeper/benchmark/TestClient.java
+++ b/bookkeeper-benchmark/src/main/java/org/apache/bookkeeper/benchmark/TestClient.java
@@ -62,7 +62,6 @@ import static com.google.common.base.Charsets.UTF_8;
  * BookKeeper and to the local file system.
  *
  */
-
 public class TestClient {
     private static final Logger LOG = LoggerFactory.getLogger(TestClient.class);
 
@@ -102,7 +101,7 @@ public class TestClient {
         long runfor = Long.parseLong(cmd.getOptionValue("runfor", "60")) * 1000;
 
         StringBuilder sb = new StringBuilder();
-        while(length-- > 0) {
+        while (length-- > 0) {
             sb.append('a');
         }
 
@@ -190,9 +189,8 @@ public class TestClient {
                 }
                 count += c;
             }
-            long time = end-start;
-            LOG.info("Finished processing writes (ms): {} TPT: {} op/s",
-                     time, count/((double)time/1000));
+            long time = end - start;
+            LOG.info("Finished processing writes (ms): {} TPT: {} op/s", time, count / ((double) time / 1000));
             executor.shutdown();
         } catch (ExecutionException ee) {
             LOG.error("Exception in worker", ee);
@@ -236,9 +234,9 @@ public class TestClient {
                 long count = 0;
                 long start = System.currentTimeMillis();
                 long stopat = start + time;
-                while(System.currentTimeMillis() < stopat) {
+                while (System.currentTimeMillis() < stopat) {
                     FSDataOutputStream stream = streams.get(r.nextInt(streams.size()));
-                    synchronized(stream) {
+                    synchronized (stream) {
                         stream.write(data);
                         stream.flush();
                         stream.hflush();
@@ -247,10 +245,10 @@ public class TestClient {
                 }
 
                 long time = (System.currentTimeMillis() - start);
-                LOG.info("Worker finished processing writes (ms): {} TPT: {} op/s",
-                         time, count/((double)time/1000));
+                LOG.info("Worker finished processing writes (ms): {} TPT: {} op/s", time,
+                         count / ((double) time / 1000));
                 return count;
-            } catch(IOException ioe) {
+            } catch (IOException ioe) {
                 LOG.error("Exception in worker thread", ioe);
                 return 0L;
             }
@@ -276,9 +274,9 @@ public class TestClient {
                 long start = System.currentTimeMillis();
 
                 long stopat = start + time;
-                while(System.currentTimeMillis() < stopat) {
+                while (System.currentTimeMillis() < stopat) {
                     FileOutputStream stream = streams.get(r.nextInt(streams.size()));
-                    synchronized(stream) {
+                    synchronized (stream) {
                         stream.write(data);
                         stream.flush();
                         stream.getChannel().force(false);
@@ -287,9 +285,10 @@ public class TestClient {
                 }
 
                 long time = (System.currentTimeMillis() - start);
-                LOG.info("Worker finished processing writes (ms): {} TPT: {} op/s", time, count/((double)time/1000));
+                LOG.info("Worker finished processing writes (ms): {} TPT: {} op/s", time,
+                         count / ((double) time / 1000));
                 return count;
-            } catch(IOException ioe) {
+            } catch (IOException ioe) {
                 LOG.error("Exception in worker thread", ioe);
                 return 0L;
             }
@@ -318,7 +317,7 @@ public class TestClient {
                 long start = System.currentTimeMillis();
 
                 long stopat = start + time;
-                while(System.currentTimeMillis() < stopat) {
+                while (System.currentTimeMillis() < stopat) {
                     LedgerHandle lh = handles.get(r.nextInt(handles.size()));
                     if (sync) {
                         lh.addEntry(data);
@@ -335,8 +334,8 @@ public class TestClient {
                 }
 
                 long time = (System.currentTimeMillis() - start);
-                LOG.info("Worker finished processing writes (ms): {} TPT: {} op/s",
-                         time, success.get()/((double)time/1000));
+                LOG.info("Worker finished processing writes (ms): {} TPT: {} op/s", time,
+                         success.get() / ((double) time / 1000));
                 return success.get();
             } catch (BKException e) {
                 LOG.error("Exception in worker thread", e);
diff --git a/bookkeeper-benchmark/src/main/java/org/apache/bookkeeper/benchmark/package-info.java b/bookkeeper-benchmark/src/main/java/org/apache/bookkeeper/benchmark/package-info.java
new file mode 100644
index 0000000..3296a78
--- /dev/null
+++ b/bookkeeper-benchmark/src/main/java/org/apache/bookkeeper/benchmark/package-info.java
@@ -0,0 +1,23 @@
+/*
+ * 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
+ * regarding copyright ownership.  The ASF licenses this file
+ * 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
+ *
+ *   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.
+ *
+ */
+/**
+ * @TODO: Write JavaDoc comment {@link https://github.com/apache/bookkepeer/issues/247}
+ */
+package org.apache.bookkeeper.benchmark;
\ No newline at end of file
diff --git a/bookkeeper-benchmark/src/test/resources/log4j.properties b/bookkeeper-benchmark/src/test/resources/log4j.properties
index 040f011..c0d9a42 100644
--- a/bookkeeper-benchmark/src/test/resources/log4j.properties
+++ b/bookkeeper-benchmark/src/test/resources/log4j.properties
@@ -1,5 +1,5 @@
 #
-# 
+#
 # 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
@@ -7,16 +7,16 @@
 # 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
-# 
+#
 #   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.
-# 
+#
 #
 
 #
diff --git a/bookkeeper-stats-providers/codahale-metrics-provider/pom.xml b/bookkeeper-stats-providers/codahale-metrics-provider/pom.xml
index 5623e1c..ed370d3 100644
--- a/bookkeeper-stats-providers/codahale-metrics-provider/pom.xml
+++ b/bookkeeper-stats-providers/codahale-metrics-provider/pom.xml
@@ -32,6 +32,38 @@
     <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
     <project.libdir>${basedir}/lib</project.libdir>
   </properties>
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-checkstyle-plugin</artifactId>
+        <version>2.17</version>
+        <dependencies>
+          <dependency>
+            <groupId>com.puppycrawl.tools</groupId>
+            <artifactId>checkstyle</artifactId>
+            <version>6.19</version>
+          </dependency>
+        </dependencies>
+        <executions>
+          <execution>
+            <id>checkstyle</id>
+            <phase>validate</phase>
+            <goals>
+              <goal>check</goal>
+            </goals>
+            <configuration>
+              <configLocation>../../checkstyle.xml</configLocation>
+              <suppressionsLocation>../../suppressions.xml</suppressionsLocation>
+              <encoding>UTF-8</encoding>
+              <consoleOutput>true</consoleOutput>
+              <failsOnError>true</failsOnError>
+            </configuration>
+          </execution>
+        </executions>
+      </plugin>
+    </plugins>
+  </build>
   <dependencies>
     <dependency>
       <groupId>org.apache.bookkeeper.stats</groupId>
diff --git a/bookkeeper-stats-providers/codahale-metrics-provider/src/main/java/org/apache/bookkeeper/stats/CodahaleMetricsProvider.java b/bookkeeper-stats-providers/codahale-metrics-provider/src/main/java/org/apache/bookkeeper/stats/CodahaleMetricsProvider.java
index 37c1461..5ba6236 100644
--- a/bookkeeper-stats-providers/codahale-metrics-provider/src/main/java/org/apache/bookkeeper/stats/CodahaleMetricsProvider.java
+++ b/bookkeeper-stats-providers/codahale-metrics-provider/src/main/java/org/apache/bookkeeper/stats/CodahaleMetricsProvider.java
@@ -43,6 +43,9 @@ import java.io.File;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+/**
+ * @TODO: Write JavaDoc comment {@link https://github.com/apache/bookkepeer/issues/247}
+ */
 @SuppressWarnings("deprecation")
 public class CodahaleMetricsProvider implements StatsProvider {
 
diff --git a/bookkeeper-stats-providers/codahale-metrics-provider/src/main/java/org/apache/bookkeeper/stats/CodahaleOpStatsLogger.java b/bookkeeper-stats-providers/codahale-metrics-provider/src/main/java/org/apache/bookkeeper/stats/CodahaleOpStatsLogger.java
index fa25059..055ae92 100644
--- a/bookkeeper-stats-providers/codahale-metrics-provider/src/main/java/org/apache/bookkeeper/stats/CodahaleOpStatsLogger.java
+++ b/bookkeeper-stats-providers/codahale-metrics-provider/src/main/java/org/apache/bookkeeper/stats/CodahaleOpStatsLogger.java
@@ -16,9 +16,6 @@
  */
 package org.apache.bookkeeper.stats;
 
-import org.apache.bookkeeper.stats.OpStatsData;
-import org.apache.bookkeeper.stats.OpStatsLogger;
-
 import com.codahale.metrics.Timer;
 import com.codahale.metrics.Snapshot;
 
@@ -66,11 +63,11 @@ class CodahaleOpStatsLogger implements OpStatsLogger {
         Snapshot s = success.getSnapshot();
         double avgLatencyMillis = s.getMean();
 
-        double[] default_percentiles = {10, 50, 90, 99, 99.9, 99.99};
-        long[] latenciesMillis = new long[default_percentiles.length];
+        double[] defaultPercentiles = {10, 50, 90, 99, 99.9, 99.99};
+        long[] latenciesMillis = new long[defaultPercentiles.length];
         Arrays.fill(latenciesMillis, Long.MAX_VALUE);
-        for (int i = 0; i < default_percentiles.length; i++) {
-            latenciesMillis[i] = (long)s.getValue(default_percentiles[i]/100);
+        for (int i = 0; i < defaultPercentiles.length; i++) {
+            latenciesMillis[i] = (long) s.getValue(defaultPercentiles[i] / 100);
         }
         return new OpStatsData(numSuccess, numFailed, avgLatencyMillis, latenciesMillis);
     }
diff --git a/bookkeeper-stats-providers/codahale-metrics-provider/src/main/java/org/apache/bookkeeper/stats/CodahaleStatsLogger.java b/bookkeeper-stats-providers/codahale-metrics-provider/src/main/java/org/apache/bookkeeper/stats/CodahaleStatsLogger.java
index 5da084b..5149ff2 100644
--- a/bookkeeper-stats-providers/codahale-metrics-provider/src/main/java/org/apache/bookkeeper/stats/CodahaleStatsLogger.java
+++ b/bookkeeper-stats-providers/codahale-metrics-provider/src/main/java/org/apache/bookkeeper/stats/CodahaleStatsLogger.java
@@ -20,11 +20,9 @@ import com.codahale.metrics.Timer;
 import com.codahale.metrics.MetricRegistry;
 import static com.codahale.metrics.MetricRegistry.name;
 
-import org.apache.bookkeeper.stats.Counter;
-import org.apache.bookkeeper.stats.Gauge;
-import org.apache.bookkeeper.stats.OpStatsLogger;
-import org.apache.bookkeeper.stats.StatsLogger;
-
+/**
+ * @TODO: Write JavaDoc comment {@link https://github.com/apache/bookkepeer/issues/247}
+ */
 public class CodahaleStatsLogger implements StatsLogger {
     protected final String basename;
     final MetricRegistry metrics;
@@ -37,7 +35,7 @@ public class CodahaleStatsLogger implements StatsLogger {
     @Override
     public OpStatsLogger getOpStatsLogger(String statName) {
         Timer success = metrics.timer(name(basename, statName));
-        Timer failure = metrics.timer(name(basename, statName+"-fail"));
+        Timer failure = metrics.timer(name(basename, statName + "-fail"));
         return new CodahaleOpStatsLogger(success, failure);
     }
 
diff --git a/bookkeeper-stats/src/main/java/org/apache/bookkeeper/stats/NullStatsProvider.java b/bookkeeper-stats-providers/codahale-metrics-provider/src/main/java/org/apache/bookkeeper/stats/package-info.java
similarity index 63%
copy from bookkeeper-stats/src/main/java/org/apache/bookkeeper/stats/NullStatsProvider.java
copy to bookkeeper-stats-providers/codahale-metrics-provider/src/main/java/org/apache/bookkeeper/stats/package-info.java
index c817e74..4a266c4 100644
--- a/bookkeeper-stats/src/main/java/org/apache/bookkeeper/stats/NullStatsProvider.java
+++ b/bookkeeper-stats-providers/codahale-metrics-provider/src/main/java/org/apache/bookkeeper/stats/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 regarding copyright ownership. The ASF
@@ -14,27 +14,7 @@
  * License for the specific language governing permissions and limitations under
  * the License.
  */
-package org.apache.bookkeeper.stats;
-
-import org.apache.commons.configuration.Configuration;
-
-public class NullStatsProvider implements StatsProvider {
-
-    final StatsLogger nullStatsLogger = new NullStatsLogger();
-
-    @Override
-    public void start(Configuration conf) {
-        // nop
-    }
-
-    @Override
-    public void stop() {
-        // nop
-    }
-
-    @Override
-    public StatsLogger getStatsLogger(String scope) {
-        return nullStatsLogger;
-    }
-
-}
+/**
+ * @TODO: Write JavaDoc Comment {@link https://github.com/apache/bookkepeer/issues/247}
+ */
+package org.apache.bookkeeper.stats;
\ No newline at end of file
diff --git a/bookkeeper-stats-providers/prometheus-metrics-provider/pom.xml b/bookkeeper-stats-providers/prometheus-metrics-provider/pom.xml
index dc13d18..ac0f09c 100644
--- a/bookkeeper-stats-providers/prometheus-metrics-provider/pom.xml
+++ b/bookkeeper-stats-providers/prometheus-metrics-provider/pom.xml
@@ -33,6 +33,39 @@
     <prometheus.version>0.0.21</prometheus.version>
   </properties>
 
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-checkstyle-plugin</artifactId>
+        <version>2.17</version>
+        <dependencies>
+          <dependency>
+            <groupId>com.puppycrawl.tools</groupId>
+            <artifactId>checkstyle</artifactId>
+            <version>6.19</version>
+          </dependency>
+        </dependencies>
+        <executions>
+          <execution>
+            <id>checkstyle</id>
+            <phase>validate</phase>
+            <goals>
+              <goal>check</goal>
+            </goals>
+            <configuration>
+              <configLocation>../../checkstyle.xml</configLocation>
+              <suppressionsLocation>../../suppressions.xml</suppressionsLocation>
+              <encoding>UTF-8</encoding>
+              <consoleOutput>true</consoleOutput>
+              <failsOnError>true</failsOnError>
+            </configuration>
+          </execution>
+        </executions>
+      </plugin>
+    </plugins>
+  </build>
+
   <dependencies>
     <dependency>
       <groupId>org.apache.bookkeeper.stats</groupId>
diff --git a/bookkeeper-stats-providers/prometheus-metrics-provider/src/main/java/org/apache/bookkeeper/stats/PrometheusCounter.java b/bookkeeper-stats-providers/prometheus-metrics-provider/src/main/java/org/apache/bookkeeper/stats/PrometheusCounter.java
index 5535a3f..5c73f38 100644
--- a/bookkeeper-stats-providers/prometheus-metrics-provider/src/main/java/org/apache/bookkeeper/stats/PrometheusCounter.java
+++ b/bookkeeper-stats-providers/prometheus-metrics-provider/src/main/java/org/apache/bookkeeper/stats/PrometheusCounter.java
@@ -20,6 +20,9 @@ import io.prometheus.client.Collector;
 import io.prometheus.client.CollectorRegistry;
 import io.prometheus.client.Gauge;
 
+/**
+ * @TODO: Write JavaDoc comment {@link https://github.com/apache/bookkepeer/issues/247}
+ */
 public class PrometheusCounter implements Counter {
 
     private final Gauge gauge;
diff --git a/bookkeeper-stats-providers/prometheus-metrics-provider/src/main/java/org/apache/bookkeeper/stats/PrometheusMetricsProvider.java b/bookkeeper-stats-providers/prometheus-metrics-provider/src/main/java/org/apache/bookkeeper/stats/PrometheusMetricsProvider.java
index 37984de..a595ed5 100644
--- a/bookkeeper-stats-providers/prometheus-metrics-provider/src/main/java/org/apache/bookkeeper/stats/PrometheusMetricsProvider.java
+++ b/bookkeeper-stats-providers/prometheus-metrics-provider/src/main/java/org/apache/bookkeeper/stats/PrometheusMetricsProvider.java
@@ -32,6 +32,9 @@ import io.prometheus.client.hotspot.MemoryPoolsExports;
 import io.prometheus.client.hotspot.StandardExports;
 import io.prometheus.client.hotspot.ThreadExports;
 
+/**
+ * @TODO: Write JavaDoc comment {@link https://github.com/apache/bookkepeer/issues/247}
+ */
 public class PrometheusMetricsProvider implements StatsProvider {
 
     private final CollectorRegistry registry = new CollectorRegistry();
diff --git a/bookkeeper-stats-providers/prometheus-metrics-provider/src/main/java/org/apache/bookkeeper/stats/PrometheusOpStatsLogger.java b/bookkeeper-stats-providers/prometheus-metrics-provider/src/main/java/org/apache/bookkeeper/stats/PrometheusOpStatsLogger.java
index e10160c..f9a9457 100644
--- a/bookkeeper-stats-providers/prometheus-metrics-provider/src/main/java/org/apache/bookkeeper/stats/PrometheusOpStatsLogger.java
+++ b/bookkeeper-stats-providers/prometheus-metrics-provider/src/main/java/org/apache/bookkeeper/stats/PrometheusOpStatsLogger.java
@@ -21,6 +21,9 @@ import java.util.concurrent.TimeUnit;
 import io.prometheus.client.CollectorRegistry;
 import io.prometheus.client.Summary;
 
+/**
+ * @TODO: Write JavaDoc comment {@link https://github.com/apache/bookkepeer/issues/247}
+ */
 public class PrometheusOpStatsLogger implements OpStatsLogger {
 
     private final Summary summary;
diff --git a/bookkeeper-stats-providers/prometheus-metrics-provider/src/main/java/org/apache/bookkeeper/stats/PrometheusStatsLogger.java b/bookkeeper-stats-providers/prometheus-metrics-provider/src/main/java/org/apache/bookkeeper/stats/PrometheusStatsLogger.java
index e58bf70..ccf1d6b 100644
--- a/bookkeeper-stats-providers/prometheus-metrics-provider/src/main/java/org/apache/bookkeeper/stats/PrometheusStatsLogger.java
+++ b/bookkeeper-stats-providers/prometheus-metrics-provider/src/main/java/org/apache/bookkeeper/stats/PrometheusStatsLogger.java
@@ -21,6 +21,9 @@ import com.google.common.base.Joiner;
 import io.prometheus.client.Collector;
 import io.prometheus.client.CollectorRegistry;
 
+/**
+ * @TODO: Write JavaDoc comment {@link https://github.com/apache/bookkepeer/issues/247}
+ */
 public class PrometheusStatsLogger implements StatsLogger {
 
     private final CollectorRegistry registry;
diff --git a/bookkeeper-stats/src/main/java/org/apache/bookkeeper/stats/NullStatsProvider.java b/bookkeeper-stats-providers/prometheus-metrics-provider/src/main/java/org/apache/bookkeeper/stats/package-info.java
similarity index 63%
copy from bookkeeper-stats/src/main/java/org/apache/bookkeeper/stats/NullStatsProvider.java
copy to bookkeeper-stats-providers/prometheus-metrics-provider/src/main/java/org/apache/bookkeeper/stats/package-info.java
index c817e74..d77aeda 100644
--- a/bookkeeper-stats/src/main/java/org/apache/bookkeeper/stats/NullStatsProvider.java
+++ b/bookkeeper-stats-providers/prometheus-metrics-provider/src/main/java/org/apache/bookkeeper/stats/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 regarding copyright ownership. The ASF
@@ -14,27 +14,7 @@
  * License for the specific language governing permissions and limitations under
  * the License.
  */
-package org.apache.bookkeeper.stats;
-
-import org.apache.commons.configuration.Configuration;
-
-public class NullStatsProvider implements StatsProvider {
-
-    final StatsLogger nullStatsLogger = new NullStatsLogger();
-
-    @Override
-    public void start(Configuration conf) {
-        // nop
-    }
-
-    @Override
-    public void stop() {
-        // nop
-    }
-
-    @Override
-    public StatsLogger getStatsLogger(String scope) {
-        return nullStatsLogger;
-    }
-
-}
+/**
+ * @TODO: Write JavaDoc comment {@link https://github.com/apache/bookkepeer/issues/247}
+ */
+package org.apache.bookkeeper.stats;
\ No newline at end of file
diff --git a/bookkeeper-stats-providers/twitter-finagle-provider/pom.xml b/bookkeeper-stats-providers/twitter-finagle-provider/pom.xml
index 1e0af00..89f95d7 100644
--- a/bookkeeper-stats-providers/twitter-finagle-provider/pom.xml
+++ b/bookkeeper-stats-providers/twitter-finagle-provider/pom.xml
@@ -32,6 +32,38 @@
     <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
     <project.libdir>${basedir}/lib</project.libdir>
   </properties>
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-checkstyle-plugin</artifactId>
+        <version>2.17</version>
+        <dependencies>
+          <dependency>
+            <groupId>com.puppycrawl.tools</groupId>
+            <artifactId>checkstyle</artifactId>
+            <version>6.19</version>
+          </dependency>
+        </dependencies>
+        <executions>
+          <execution>
+            <id>checkstyle</id>
+            <phase>validate</phase>
+            <goals>
+              <goal>check</goal>
+            </goals>
+            <configuration>
+              <configLocation>../../checkstyle.xml</configLocation>
+              <suppressionsLocation>../../suppressions.xml</suppressionsLocation>
+              <encoding>UTF-8</encoding>
+              <consoleOutput>true</consoleOutput>
+              <failsOnError>true</failsOnError>
+            </configuration>
+          </execution>
+        </executions>
+      </plugin>
+    </plugins>
+  </build>
   <dependencies>
     <dependency>
       <groupId>org.apache.bookkeeper.stats</groupId>
diff --git a/bookkeeper-stats-providers/twitter-finagle-provider/src/main/java/org/apache/bookkeeper/stats/twitter/finagle/CounterImpl.java b/bookkeeper-stats-providers/twitter-finagle-provider/src/main/java/org/apache/bookkeeper/stats/twitter/finagle/CounterImpl.java
index a065323..b4b8146 100644
--- a/bookkeeper-stats-providers/twitter-finagle-provider/src/main/java/org/apache/bookkeeper/stats/twitter/finagle/CounterImpl.java
+++ b/bookkeeper-stats-providers/twitter-finagle-provider/src/main/java/org/apache/bookkeeper/stats/twitter/finagle/CounterImpl.java
@@ -25,7 +25,7 @@ import org.apache.bookkeeper.stats.Counter;
  * It also has a limitation in size: max bound is signed integer, not long.
  */
 class CounterImpl implements Counter {
-    final private com.twitter.finagle.stats.Counter counter;
+    private final com.twitter.finagle.stats.Counter counter;
 
     public CounterImpl(final String name,
                        final StatsReceiver stats) {
diff --git a/bookkeeper-stats-providers/twitter-finagle-provider/src/main/java/org/apache/bookkeeper/stats/twitter/finagle/FinagleStatsLoggerImpl.java b/bookkeeper-stats-providers/twitter-finagle-provider/src/main/java/org/apache/bookkeeper/stats/twitter/finagle/FinagleStatsLoggerImpl.java
index cef8d71..a6fda06 100644
--- a/bookkeeper-stats-providers/twitter-finagle-provider/src/main/java/org/apache/bookkeeper/stats/twitter/finagle/FinagleStatsLoggerImpl.java
+++ b/bookkeeper-stats-providers/twitter-finagle-provider/src/main/java/org/apache/bookkeeper/stats/twitter/finagle/FinagleStatsLoggerImpl.java
@@ -29,8 +29,11 @@ import java.util.Arrays;
 import java.util.HashMap;
 import java.util.Map;
 
+/**
+ * @TODO: Write JavaDoc comment {@link https://github.com/apache/bookkepeer/issues/247}
+ */
 public class FinagleStatsLoggerImpl implements StatsLogger {
-    final private StatsReceiver stats;
+    private final StatsReceiver stats;
     // keep the references for finagle gauges. they are destroyed when the stats logger is destroyed.
     final Map<Gauge, com.twitter.finagle.stats.Gauge> finagleGauges;
 
diff --git a/bookkeeper-stats-providers/twitter-finagle-provider/src/main/java/org/apache/bookkeeper/stats/twitter/finagle/FinagleStatsProvider.java b/bookkeeper-stats-providers/twitter-finagle-provider/src/main/java/org/apache/bookkeeper/stats/twitter/finagle/FinagleStatsProvider.java
index 113c257..affe2f9 100644
--- a/bookkeeper-stats-providers/twitter-finagle-provider/src/main/java/org/apache/bookkeeper/stats/twitter/finagle/FinagleStatsProvider.java
+++ b/bookkeeper-stats-providers/twitter-finagle-provider/src/main/java/org/apache/bookkeeper/stats/twitter/finagle/FinagleStatsProvider.java
@@ -25,10 +25,10 @@ import org.apache.commons.configuration.Configuration;
 /**
  * Main entry point to use Finagle stats for Bookkeeper.
  *
- * There's no requirement to start or stop it.
+ * <p>There's no requirement to start or stop it.</p>
  */
 public class FinagleStatsProvider implements StatsProvider {
-    final private StatsReceiver stats;
+    private final StatsReceiver stats;
 
     public FinagleStatsProvider(final StatsReceiver stats) {
         this.stats = stats;
diff --git a/bookkeeper-stats-providers/twitter-finagle-provider/src/main/java/org/apache/bookkeeper/stats/twitter/finagle/OpStatsLoggerImpl.java b/bookkeeper-stats-providers/twitter-finagle-provider/src/main/java/org/apache/bookkeeper/stats/twitter/finagle/OpStatsLoggerImpl.java
index 775c4be..1fd61fe 100644
--- a/bookkeeper-stats-providers/twitter-finagle-provider/src/main/java/org/apache/bookkeeper/stats/twitter/finagle/OpStatsLoggerImpl.java
+++ b/bookkeeper-stats-providers/twitter-finagle-provider/src/main/java/org/apache/bookkeeper/stats/twitter/finagle/OpStatsLoggerImpl.java
@@ -27,13 +27,13 @@ import org.apache.bookkeeper.stats.OpStatsLogger;
  * A percentile stat that will delegate to Finagle stats' implementation library
  * to compute the percentiles.
  *
- * Note: metrics will be exposed in form $name/success.p99 for successful events,
- * and $name/failure.p99 for failed ones.
+ * <p>Note: metrics will be exposed in form $name/success.p99 for successful events,
+ * and $name/failure.p99 for failed ones.</p>
  */
 public class OpStatsLoggerImpl implements OpStatsLogger {
-    final private static OpStatsData NULL_OP_STATS = new OpStatsData(0, 0, 0, new long[6]);
-    final private Stat success;
-    final private Stat failure;
+    private static final OpStatsData NULL_OP_STATS = new OpStatsData(0, 0, 0, new long[6]);
+    private final Stat success;
+    private final Stat failure;
 
     public OpStatsLoggerImpl(final String name, final StatsReceiver stats) {
         this.success = stats.scope(String.format("%s/success", name)).stat0(name);
diff --git a/bookkeeper-stats/src/main/java/org/apache/bookkeeper/stats/Gauge.java b/bookkeeper-stats-providers/twitter-finagle-provider/src/main/java/org/apache/bookkeeper/stats/twitter/finagle/package-info.java
similarity index 71%
copy from bookkeeper-stats/src/main/java/org/apache/bookkeeper/stats/Gauge.java
copy to bookkeeper-stats-providers/twitter-finagle-provider/src/main/java/org/apache/bookkeeper/stats/twitter/finagle/package-info.java
index 326b7e1..65629d7 100644
--- a/bookkeeper-stats/src/main/java/org/apache/bookkeeper/stats/Gauge.java
+++ b/bookkeeper-stats-providers/twitter-finagle-provider/src/main/java/org/apache/bookkeeper/stats/twitter/finagle/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,14 +15,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.bookkeeper.stats;
-
 /**
- * A guage is a value that has only one value at a specific point in time.
- * An example is the number of elements in a queue. The value of T must be
- * some numeric type.
+ * @TODO: Write JavaDoc comment {@link https://github.com/apache/bookkepeer/issues/247}
  */
-public interface Gauge<T extends Number> {
-    public T getDefaultValue();
-    public T getSample();
-}
+package org.apache.bookkeeper.stats.twitter.finagle;
\ No newline at end of file
diff --git a/bookkeeper-stats-providers/twitter-ostrich-provider/pom.xml b/bookkeeper-stats-providers/twitter-ostrich-provider/pom.xml
index 1d7f987..3924cb8 100644
--- a/bookkeeper-stats-providers/twitter-ostrich-provider/pom.xml
+++ b/bookkeeper-stats-providers/twitter-ostrich-provider/pom.xml
@@ -32,6 +32,38 @@
     <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
     <project.libdir>${basedir}/lib</project.libdir>
   </properties>
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-checkstyle-plugin</artifactId>
+        <version>2.17</version>
+        <dependencies>
+          <dependency>
+            <groupId>com.puppycrawl.tools</groupId>
+            <artifactId>checkstyle</artifactId>
+            <version>6.19</version>
+          </dependency>
+        </dependencies>
+        <executions>
+          <execution>
+            <id>checkstyle</id>
+            <phase>validate</phase>
+            <goals>
+              <goal>check</goal>
+            </goals>
+            <configuration>
+              <configLocation>../../checkstyle.xml</configLocation>
+              <suppressionsLocation>../../suppressions.xml</suppressionsLocation>
+              <encoding>UTF-8</encoding>
+              <consoleOutput>true</consoleOutput>
+              <failsOnError>true</failsOnError>
+            </configuration>
+          </execution>
+        </executions>
+      </plugin>
+    </plugins>
+  </build>
   <dependencies>
     <dependency>
       <groupId>org.apache.bookkeeper.stats</groupId>
diff --git a/bookkeeper-stats-providers/twitter-ostrich-provider/src/main/java/org/apache/bookkeeper/stats/twitter/ostrich/CounterImpl.java b/bookkeeper-stats-providers/twitter-ostrich-provider/src/main/java/org/apache/bookkeeper/stats/twitter/ostrich/CounterImpl.java
index 9035629..bd5ca69 100644
--- a/bookkeeper-stats-providers/twitter-ostrich-provider/src/main/java/org/apache/bookkeeper/stats/twitter/ostrich/CounterImpl.java
+++ b/bookkeeper-stats-providers/twitter-ostrich-provider/src/main/java/org/apache/bookkeeper/stats/twitter/ostrich/CounterImpl.java
@@ -43,7 +43,7 @@ class CounterImpl implements Counter {
 
     @Override
     public void add(long delta) {
-        this.ostrichCounter.incr((int)delta);
+        this.ostrichCounter.incr((int) delta);
     }
 
     @Override
diff --git a/bookkeeper-stats-providers/twitter-ostrich-provider/src/main/java/org/apache/bookkeeper/stats/twitter/ostrich/OstrichProvider.java b/bookkeeper-stats-providers/twitter-ostrich-provider/src/main/java/org/apache/bookkeeper/stats/twitter/ostrich/OstrichProvider.java
index d4d00d3..662dfb0 100644
--- a/bookkeeper-stats-providers/twitter-ostrich-provider/src/main/java/org/apache/bookkeeper/stats/twitter/ostrich/OstrichProvider.java
+++ b/bookkeeper-stats-providers/twitter-ostrich-provider/src/main/java/org/apache/bookkeeper/stats/twitter/ostrich/OstrichProvider.java
@@ -35,11 +35,14 @@ import scala.util.matching.Regex;
 
 import java.util.concurrent.TimeUnit;
 
+/**
+ * @TODO: Write JavaDoc comment {@link https://github.com/apache/bookkepeer/issues/247}
+ */
 public class OstrichProvider implements StatsProvider {
 
-    protected final static String STATS_EXPORT = "statsExport";
-    protected final static String STATS_HTTP_PORT = "statsHttpPort";
-    protected final static String SHOULD_SHUTDOWN_SERVICE_TRACKER = "shouldShutdownServiceTracker";
+    protected static final String STATS_EXPORT = "statsExport";
+    protected static final String STATS_HTTP_PORT = "statsHttpPort";
+    protected static final String SHOULD_SHUTDOWN_SERVICE_TRACKER = "shouldShutdownServiceTracker";
 
     private com.twitter.ostrich.admin.AdminHttpService statsExporter = null;
     private final CachingStatsProvider cachingStatsProvider;
@@ -48,7 +51,7 @@ public class OstrichProvider implements StatsProvider {
     private static List<Duration> list(Duration ... ts) {
         List<Duration> result = List$.MODULE$.empty();
         for (int i = ts.length; i > 0; i--) {
-            result = new $colon$colon<>(ts[i-1], result);
+            result = new $colon$colon<>(ts[i - 1], result);
         }
         return result;
     }
diff --git a/bookkeeper-stats/src/main/java/org/apache/bookkeeper/stats/NullStatsProvider.java b/bookkeeper-stats-providers/twitter-ostrich-provider/src/main/java/org/apache/bookkeeper/stats/twitter/ostrich/package-info.java
similarity index 63%
copy from bookkeeper-stats/src/main/java/org/apache/bookkeeper/stats/NullStatsProvider.java
copy to bookkeeper-stats-providers/twitter-ostrich-provider/src/main/java/org/apache/bookkeeper/stats/twitter/ostrich/package-info.java
index c817e74..4dfac05 100644
--- a/bookkeeper-stats/src/main/java/org/apache/bookkeeper/stats/NullStatsProvider.java
+++ b/bookkeeper-stats-providers/twitter-ostrich-provider/src/main/java/org/apache/bookkeeper/stats/twitter/ostrich/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 regarding copyright ownership. The ASF
@@ -14,27 +14,7 @@
  * License for the specific language governing permissions and limitations under
  * the License.
  */
-package org.apache.bookkeeper.stats;
-
-import org.apache.commons.configuration.Configuration;
-
-public class NullStatsProvider implements StatsProvider {
-
-    final StatsLogger nullStatsLogger = new NullStatsLogger();
-
-    @Override
-    public void start(Configuration conf) {
-        // nop
-    }
-
-    @Override
-    public void stop() {
-        // nop
-    }
-
-    @Override
-    public StatsLogger getStatsLogger(String scope) {
-        return nullStatsLogger;
-    }
-
-}
+/**
+ * @TODO: Write JavaDOc comment {@link https://github.com/apache/bookkepeer/issues/247}
+ */
+package org.apache.bookkeeper.stats.twitter.ostrich;
\ No newline at end of file
diff --git a/bookkeeper-stats-providers/twitter-science-provider/pom.xml b/bookkeeper-stats-providers/twitter-science-provider/pom.xml
index 96e7303..2e0a8bc 100644
--- a/bookkeeper-stats-providers/twitter-science-provider/pom.xml
+++ b/bookkeeper-stats-providers/twitter-science-provider/pom.xml
@@ -32,6 +32,38 @@
     <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
     <project.libdir>${basedir}/lib</project.libdir>
   </properties>
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-checkstyle-plugin</artifactId>
+        <version>2.17</version>
+        <dependencies>
+          <dependency>
+            <groupId>com.puppycrawl.tools</groupId>
+            <artifactId>checkstyle</artifactId>
+            <version>6.19</version>
+          </dependency>
+        </dependencies>
+        <executions>
+          <execution>
+            <id>checkstyle</id>
+            <phase>validate</phase>
+            <goals>
+              <goal>check</goal>
+            </goals>
+            <configuration>
+              <configLocation>../../checkstyle.xml</configLocation>
+              <suppressionsLocation>../../suppressions.xml</suppressionsLocation>
+              <encoding>UTF-8</encoding>
+              <consoleOutput>true</consoleOutput>
+              <failsOnError>true</failsOnError>
+            </configuration>
+          </execution>
+        </executions>
+      </plugin>
+    </plugins>
+  </build>
   <dependencies>
     <dependency>
       <groupId>org.apache.bookkeeper.stats</groupId>
diff --git a/bookkeeper-stats-providers/twitter-science-provider/src/main/java/org/apache/bookkeeper/stats/twitter/science/CounterImpl.java b/bookkeeper-stats-providers/twitter-science-provider/src/main/java/org/apache/bookkeeper/stats/twitter/science/CounterImpl.java
index df5c7ad..9a27e89 100644
--- a/bookkeeper-stats-providers/twitter-science-provider/src/main/java/org/apache/bookkeeper/stats/twitter/science/CounterImpl.java
+++ b/bookkeeper-stats-providers/twitter-science-provider/src/main/java/org/apache/bookkeeper/stats/twitter/science/CounterImpl.java
@@ -22,7 +22,7 @@ import org.apache.bookkeeper.stats.Counter;
 
 import java.util.concurrent.atomic.AtomicLong;
 /**
- * This will export the value and the rate (per sec) to {@link org.apache.bookkeeper.stats.Stats}
+ * This will export the value and the rate (per sec) to {@link org.apache.bookkeeper.stats.Stats}.
  */
 public class CounterImpl implements Counter {
     // The name used to export this stat
diff --git a/bookkeeper-stats-providers/twitter-science-provider/src/main/java/org/apache/bookkeeper/stats/twitter/science/HTTPStatsExporter.java b/bookkeeper-stats-providers/twitter-science-provider/src/main/java/org/apache/bookkeeper/stats/twitter/science/HTTPStatsExporter.java
index 2ac29da..56791c0 100644
--- a/bookkeeper-stats-providers/twitter-science-provider/src/main/java/org/apache/bookkeeper/stats/twitter/science/HTTPStatsExporter.java
+++ b/bookkeeper-stats-providers/twitter-science-provider/src/main/java/org/apache/bookkeeper/stats/twitter/science/HTTPStatsExporter.java
@@ -23,7 +23,11 @@ import com.twitter.common.net.http.handlers.VarsHandler;
 import com.twitter.common.net.http.handlers.VarsJsonHandler;
 import com.twitter.common.quantity.Amount;
 import com.twitter.common.quantity.Time;
-import com.twitter.common.stats.*;
+import com.twitter.common.stats.JvmStats;
+import com.twitter.common.stats.Stat;
+import com.twitter.common.stats.Stats;
+import com.twitter.common.stats.TimeSeriesRepository;
+import com.twitter.common.stats.TimeSeriesRepositoryImpl;
 import org.eclipse.jetty.server.Server;
 import org.eclipse.jetty.servlet.ServletContextHandler;
 import org.eclipse.jetty.servlet.ServletHolder;
@@ -45,7 +49,7 @@ public class HTTPStatsExporter {
 
     public void start() throws Exception {
         // Start the sampler. Sample every 1 second and retain for 1 hour
-        // TODO(Aniruddha): Make this configurable if needed.
+        // TODO: Make this configurable if needed.
         TimeSeriesRepository sampler = new TimeSeriesRepositoryImpl(Stats.STAT_REGISTRY,
                 Amount.of(1L, Time.SECONDS), Amount.of(1L, Time.HOURS));
         sampler.start(this.shutDownRegistry);
diff --git a/bookkeeper-stats-providers/twitter-science-provider/src/main/java/org/apache/bookkeeper/stats/twitter/science/OpStatsLoggerImpl.java b/bookkeeper-stats-providers/twitter-science-provider/src/main/java/org/apache/bookkeeper/stats/twitter/science/OpStatsLoggerImpl.java
index 77c4bff..24c8429 100644
--- a/bookkeeper-stats-providers/twitter-science-provider/src/main/java/org/apache/bookkeeper/stats/twitter/science/OpStatsLoggerImpl.java
+++ b/bookkeeper-stats-providers/twitter-science-provider/src/main/java/org/apache/bookkeeper/stats/twitter/science/OpStatsLoggerImpl.java
@@ -16,7 +16,8 @@
  */
 package org.apache.bookkeeper.stats.twitter.science;
 
-import com.twitter.common.stats.*;
+import com.twitter.common.stats.RequestStats;
+import com.twitter.common.stats.Stat;
 import org.apache.bookkeeper.stats.OpStatsData;
 import org.apache.bookkeeper.stats.OpStatsLogger;
 
@@ -53,7 +54,7 @@ public class OpStatsLoggerImpl implements OpStatsLogger {
     }
 
     public synchronized void clear() {
-        //TODO(Aniruddha): Figure out how to clear RequestStats. Till then this is a no-op
+        //TODO: Figure out how to clear RequestStats. Till then this is a no-op
     }
 
     /**
@@ -63,15 +64,15 @@ public class OpStatsLoggerImpl implements OpStatsLogger {
         long numFailed = this.events.getErrorCount();
         long numSuccess = this.events.getSlidingStats().getEventCounter().get() - numFailed;
         double avgLatencyMillis = this.events.getSlidingStats().getPerEventLatency().read() / 1000.0;
-        double[] default_percentiles = {10, 50, 90, 99, 99.9, 99.99};
-        long[] latenciesMillis = new long[default_percentiles.length];
+        double[] defaultPercentiles = {10, 50, 90, 99, 99.9, 99.99};
+        long[] latenciesMillis = new long[defaultPercentiles.length];
         Arrays.fill(latenciesMillis, Long.MAX_VALUE);
         Map<Double, ? extends Stat> realPercentileLatencies =
                 this.events.getPercentile().getPercentiles();
-        for (int i = 0; i < default_percentiles.length; i++) {
-            if (realPercentileLatencies.containsKey(default_percentiles[i])) {
+        for (int i = 0; i < defaultPercentiles.length; i++) {
+            if (realPercentileLatencies.containsKey(defaultPercentiles[i])) {
                 @SuppressWarnings("unchecked")
-                Stat<Double> latency = realPercentileLatencies.get(default_percentiles[i]);
+                Stat<Double> latency = realPercentileLatencies.get(defaultPercentiles[i]);
                 latenciesMillis[i] = TimeUnit.MICROSECONDS.toMillis(latency.read().longValue());
             }
         }
diff --git a/bookkeeper-stats-providers/twitter-science-provider/src/main/java/org/apache/bookkeeper/stats/twitter/science/TwitterStatsProvider.java b/bookkeeper-stats-providers/twitter-science-provider/src/main/java/org/apache/bookkeeper/stats/twitter/science/TwitterStatsProvider.java
index 68d1ab1..197d06f 100644
--- a/bookkeeper-stats-providers/twitter-science-provider/src/main/java/org/apache/bookkeeper/stats/twitter/science/TwitterStatsProvider.java
+++ b/bookkeeper-stats-providers/twitter-science-provider/src/main/java/org/apache/bookkeeper/stats/twitter/science/TwitterStatsProvider.java
@@ -23,12 +23,15 @@ import org.apache.commons.configuration.Configuration;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+/**
+ * @TODO: Write JavaDoc comment {@link https://github.com/apache/bookkepeer/issues/247}
+ */
 public class TwitterStatsProvider implements StatsProvider {
 
     static final Logger LOG = LoggerFactory.getLogger(TwitterStatsProvider.class);
 
-    protected final static String STATS_EXPORT = "statsExport";
-    protected final static String STATS_HTTP_PORT = "statsHttpPort";
+    protected static final String STATS_EXPORT = "statsExport";
+    protected static final String STATS_HTTP_PORT = "statsHttpPort";
 
     private HTTPStatsExporter statsExporter = null;
     private final CachingStatsProvider cachingStatsProvider;
diff --git a/bookkeeper-stats/src/main/java/org/apache/bookkeeper/stats/NullStatsProvider.java b/bookkeeper-stats-providers/twitter-science-provider/src/main/java/org/apache/bookkeeper/stats/twitter/science/package-info.java
similarity index 63%
copy from bookkeeper-stats/src/main/java/org/apache/bookkeeper/stats/NullStatsProvider.java
copy to bookkeeper-stats-providers/twitter-science-provider/src/main/java/org/apache/bookkeeper/stats/twitter/science/package-info.java
index c817e74..1901816 100644
--- a/bookkeeper-stats/src/main/java/org/apache/bookkeeper/stats/NullStatsProvider.java
+++ b/bookkeeper-stats-providers/twitter-science-provider/src/main/java/org/apache/bookkeeper/stats/twitter/science/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 regarding copyright ownership. The ASF
@@ -14,27 +14,7 @@
  * License for the specific language governing permissions and limitations under
  * the License.
  */
-package org.apache.bookkeeper.stats;
-
-import org.apache.commons.configuration.Configuration;
-
-public class NullStatsProvider implements StatsProvider {
-
-    final StatsLogger nullStatsLogger = new NullStatsLogger();
-
-    @Override
-    public void start(Configuration conf) {
-        // nop
-    }
-
-    @Override
-    public void stop() {
-        // nop
-    }
-
-    @Override
-    public StatsLogger getStatsLogger(String scope) {
-        return nullStatsLogger;
-    }
-
-}
+/**
+ * @TODO: Write JavaDoc comment {@link https://github.com/apache/bookkepeer/issues/247}
+ */
+package org.apache.bookkeeper.stats.twitter.science;
\ No newline at end of file
diff --git a/bookkeeper-stats/pom.xml b/bookkeeper-stats/pom.xml
index a3389e7..785d737 100644
--- a/bookkeeper-stats/pom.xml
+++ b/bookkeeper-stats/pom.xml
@@ -31,6 +31,38 @@
     <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
     <project.libdir>${basedir}/lib</project.libdir>
   </properties>
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-checkstyle-plugin</artifactId>
+        <version>2.17</version>
+        <dependencies>
+          <dependency>
+            <groupId>com.puppycrawl.tools</groupId>
+            <artifactId>checkstyle</artifactId>
+            <version>6.19</version>
+          </dependency>
+        </dependencies>
+        <executions>
+          <execution>
+            <id>checkstyle</id>
+            <phase>validate</phase>
+            <goals>
+              <goal>check</goal>
+            </goals>
+            <configuration>
+              <configLocation>../checkstyle.xml</configLocation>
+              <suppressionsLocation>../suppressions.xml</suppressionsLocation>
+              <encoding>UTF-8</encoding>
+              <consoleOutput>true</consoleOutput>
+              <failsOnError>true</failsOnError>
+            </configuration>
+          </execution>
+        </executions>
+      </plugin>
+    </plugins>
+  </build>
   <dependencies>
     <dependency>
       <groupId>commons-configuration</groupId>
diff --git a/bookkeeper-stats/src/main/java/org/apache/bookkeeper/stats/CachingStatsLogger.java b/bookkeeper-stats/src/main/java/org/apache/bookkeeper/stats/CachingStatsLogger.java
index ec553d9..b39d3a9 100644
--- a/bookkeeper-stats/src/main/java/org/apache/bookkeeper/stats/CachingStatsLogger.java
+++ b/bookkeeper-stats/src/main/java/org/apache/bookkeeper/stats/CachingStatsLogger.java
@@ -19,6 +19,9 @@ package org.apache.bookkeeper.stats;
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.ConcurrentMap;
 
+/**
+ * @TODO: Write JavaDoc comment {@link https://github.com/apache/bookkepeer/issues/247}
+ */
 public class CachingStatsLogger implements StatsLogger {
 
     protected final StatsLogger underlying;
diff --git a/bookkeeper-stats/src/main/java/org/apache/bookkeeper/stats/CachingStatsProvider.java b/bookkeeper-stats/src/main/java/org/apache/bookkeeper/stats/CachingStatsProvider.java
index 609a258..715fd53 100644
--- a/bookkeeper-stats/src/main/java/org/apache/bookkeeper/stats/CachingStatsProvider.java
+++ b/bookkeeper-stats/src/main/java/org/apache/bookkeeper/stats/CachingStatsProvider.java
@@ -21,6 +21,9 @@ import org.apache.commons.configuration.Configuration;
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.ConcurrentMap;
 
+/**
+ * @TODO: Write JavaDoc comment {@link https://github.com/apache/bookkepeer/issues/247}
+ */
 public class CachingStatsProvider implements StatsProvider {
 
     protected final StatsProvider underlying;
diff --git a/bookkeeper-stats/src/main/java/org/apache/bookkeeper/stats/Counter.java b/bookkeeper-stats/src/main/java/org/apache/bookkeeper/stats/Counter.java
index 393c24c..7160d7c 100644
--- a/bookkeeper-stats/src/main/java/org/apache/bookkeeper/stats/Counter.java
+++ b/bookkeeper-stats/src/main/java/org/apache/bookkeeper/stats/Counter.java
@@ -25,26 +25,26 @@ public interface Counter {
     /**
      * Clear this stat.
      */
-    public void clear();
+    void clear();
 
     /**
      * Increment the value associated with this stat.
      */
-    public void inc();
+    void inc();
 
     /**
      * Decrement the value associated with this stat.
      */
-    public void dec();
+    void dec();
 
     /**
      * Add delta to the value associated with this stat.
      * @param delta
      */
-    public void add(long delta);
+    void add(long delta);
 
     /**
      * Get the value associated with this stat.
      */
-    public Long get();
+    Long get();
 }
diff --git a/bookkeeper-stats/src/main/java/org/apache/bookkeeper/stats/Gauge.java b/bookkeeper-stats/src/main/java/org/apache/bookkeeper/stats/Gauge.java
index 326b7e1..7bcca64 100644
--- a/bookkeeper-stats/src/main/java/org/apache/bookkeeper/stats/Gauge.java
+++ b/bookkeeper-stats/src/main/java/org/apache/bookkeeper/stats/Gauge.java
@@ -23,6 +23,6 @@ package org.apache.bookkeeper.stats;
  * some numeric type.
  */
 public interface Gauge<T extends Number> {
-    public T getDefaultValue();
-    public T getSample();
+    T getDefaultValue();
+    T getSample();
 }
diff --git a/bookkeeper-stats/src/main/java/org/apache/bookkeeper/stats/NullStatsLogger.java b/bookkeeper-stats/src/main/java/org/apache/bookkeeper/stats/NullStatsLogger.java
index 10226b2..bf68788 100644
--- a/bookkeeper-stats/src/main/java/org/apache/bookkeeper/stats/NullStatsLogger.java
+++ b/bookkeeper-stats/src/main/java/org/apache/bookkeeper/stats/NullStatsLogger.java
@@ -18,6 +18,9 @@ package org.apache.bookkeeper.stats;
 
 import java.util.concurrent.TimeUnit;
 
+/**
+ * @TODO: Write JavaDoc comment {@link https://github.com/apache/bookkepeer/issues/247}
+ */
 public class NullStatsLogger implements StatsLogger {
 
     public static final NullStatsLogger INSTANCE = new NullStatsLogger();
diff --git a/bookkeeper-stats/src/main/java/org/apache/bookkeeper/stats/NullStatsProvider.java b/bookkeeper-stats/src/main/java/org/apache/bookkeeper/stats/NullStatsProvider.java
index c817e74..4d9e228 100644
--- a/bookkeeper-stats/src/main/java/org/apache/bookkeeper/stats/NullStatsProvider.java
+++ b/bookkeeper-stats/src/main/java/org/apache/bookkeeper/stats/NullStatsProvider.java
@@ -18,6 +18,9 @@ package org.apache.bookkeeper.stats;
 
 import org.apache.commons.configuration.Configuration;
 
+/**
+ * @TODO: Write JavaDoc comment {@link https://github.com/apache/bookkepeer/issues/247}
+ */
 public class NullStatsProvider implements StatsProvider {
 
     final StatsLogger nullStatsLogger = new NullStatsLogger();
diff --git a/bookkeeper-stats/src/main/java/org/apache/bookkeeper/stats/OpStatsData.java b/bookkeeper-stats/src/main/java/org/apache/bookkeeper/stats/OpStatsData.java
index 1d3cd5f..683386f 100644
--- a/bookkeeper-stats/src/main/java/org/apache/bookkeeper/stats/OpStatsData.java
+++ b/bookkeeper-stats/src/main/java/org/apache/bookkeeper/stats/OpStatsData.java
@@ -28,7 +28,7 @@ public class OpStatsData {
     // All latency values are in Milliseconds.
     private final double avgLatencyMillis;
     // 10.0 50.0, 90.0, 99.0, 99.9, 99.99 in that order.
-    // TODO(Aniruddha): Figure out if we can use a Map
+    // TODO: Figure out if we can use a Map
     private final long[] percentileLatenciesMillis;
     public OpStatsData (long numSuccessfulEvents, long numFailedEvents,
                         double avgLatencyMillis, long[] percentileLatenciesMillis) {
diff --git a/bookkeeper-stats/src/main/java/org/apache/bookkeeper/stats/OpStatsLogger.java b/bookkeeper-stats/src/main/java/org/apache/bookkeeper/stats/OpStatsLogger.java
index bbd6992..cef8304 100644
--- a/bookkeeper-stats/src/main/java/org/apache/bookkeeper/stats/OpStatsLogger.java
+++ b/bookkeeper-stats/src/main/java/org/apache/bookkeeper/stats/OpStatsLogger.java
@@ -19,8 +19,7 @@ package org.apache.bookkeeper.stats;
 import java.util.concurrent.TimeUnit;
 
 /**
- * This interface handles logging of statistics related to each operation (PUBLISH,
- * CONSUME etc.)
+ * This interface handles logging of statistics related to each operation. (PUBLISH, CONSUME etc.)
  */
 public interface OpStatsLogger {
 
@@ -29,7 +28,7 @@ public interface OpStatsLogger {
      * @param eventLatencyMillis The event latency
      * @param unit
      */
-    public void registerFailedEvent(long eventLatency, TimeUnit unit);
+    void registerFailedEvent(long eventLatencyMillis, TimeUnit unit);
 
     /**
      * An operation succeeded with the given eventLatency. Update
@@ -37,28 +36,28 @@ public interface OpStatsLogger {
      * @param eventLatencyMillis The event latency
      * @param unit
      */
-    public void registerSuccessfulEvent(long eventLatency, TimeUnit unit);
+    void registerSuccessfulEvent(long eventLatencyMillis, TimeUnit unit);
 
     /**
-     * An operation with the given value succeeded
+     * An operation with the given value succeeded.
      * @param value
      */
-    public void registerSuccessfulValue(long value);
+    void registerSuccessfulValue(long value);
 
     /**
-     * An operation with the given value failed
+     * An operation with the given value failed.
      */
-    public void registerFailedValue(long value);
+    void registerFailedValue(long value);
 
     /**
      * @return Returns an OpStatsData object with necessary values. We need this function
      * to support JMX exports. This should be deprecated sometime in the near future.
      * populated.
      */
-    public OpStatsData toOpStatsData();
+    OpStatsData toOpStatsData();
 
     /**
      * Clear stats for this operation.
      */
-    public void clear();
+    void clear();
 }
diff --git a/bookkeeper-stats/src/main/java/org/apache/bookkeeper/stats/Stats.java b/bookkeeper-stats/src/main/java/org/apache/bookkeeper/stats/Stats.java
index 8f8ca45..2c970c0 100644
--- a/bookkeeper-stats/src/main/java/org/apache/bookkeeper/stats/Stats.java
+++ b/bookkeeper-stats/src/main/java/org/apache/bookkeeper/stats/Stats.java
@@ -27,9 +27,12 @@ import org.slf4j.LoggerFactory;
 import java.lang.reflect.Constructor;
 import java.lang.reflect.InvocationTargetException;
 
+/**
+ * @TODO: Write JavaDoc comment {@link https://github.com/apache/bookkepeer/issues/247}
+ */
 public class Stats {
     static final Logger LOG = LoggerFactory.getLogger(Stats.class);
-    public final static String STATS_PROVIDER_CLASS = "statsProviderClass";
+    public static final String STATS_PROVIDER_CLASS = "statsProviderClass";
 
     static StatsProvider prov = new NullStatsProvider();
 
@@ -40,10 +43,10 @@ public class Stats {
                 Class cls = Class.forName(className);
                 @SuppressWarnings("unchecked")
                 Constructor<? extends StatsProvider> cons =
-                    (Constructor<? extends StatsProvider>)cls.getDeclaredConstructor();
+                    (Constructor<? extends StatsProvider>) cls.getDeclaredConstructor();
                 prov = cons.newInstance();
             } catch (ClassNotFoundException cnfe) {
-                LOG.error("Couldn't find configured class(" + className +")", cnfe);
+                LOG.error("Couldn't find configured class(" + className + ")", cnfe);
             } catch (NoSuchMethodException nsme) {
                 LOG.error("Couldn't find default constructor for class (" + className + ")", nsme);
             } catch (InstantiationException ie) {
diff --git a/bookkeeper-stats/src/main/java/org/apache/bookkeeper/stats/StatsLogger.java b/bookkeeper-stats/src/main/java/org/apache/bookkeeper/stats/StatsLogger.java
index 7a32eae..f750685 100644
--- a/bookkeeper-stats/src/main/java/org/apache/bookkeeper/stats/StatsLogger.java
+++ b/bookkeeper-stats/src/main/java/org/apache/bookkeeper/stats/StatsLogger.java
@@ -26,14 +26,14 @@ public interface StatsLogger {
      *          Stats Name
      * @return Get the logger for an OpStat described by the <i>name</i>.
      */
-    public OpStatsLogger getOpStatsLogger(String name);
+    OpStatsLogger getOpStatsLogger(String name);
 
     /**
      * @param name
      *          Stats Name
      * @return Get the logger for a simple stat described by the <i>name</i>
      */
-    public Counter getCounter(String name);
+    Counter getCounter(String name);
 
     /**
      * Register given <i>gauge</i> as name <i>name</i>.
@@ -43,7 +43,7 @@ public interface StatsLogger {
      * @param gauge
      *          gauge function
      */
-    public <T extends Number> void registerGauge(String name, Gauge<T> gauge);
+    <T extends Number> void registerGauge(String name, Gauge<T> gauge);
 
     /**
      * Unregister given <i>gauge</i> from name <i>name</i>.
@@ -53,7 +53,7 @@ public interface StatsLogger {
      * @param gauge
      *          gauge function
      */
-    public <T extends Number> void unregisterGauge(String name, Gauge<T> gauge);
+    <T extends Number> void unregisterGauge(String name, Gauge<T> gauge);
 
     /**
      * Provide the stats logger under scope <i>name</i>.
@@ -62,7 +62,7 @@ public interface StatsLogger {
      *          scope name.
      * @return stats logger under scope <i>name</i>.
      */
-    public StatsLogger scope(String name);
+    StatsLogger scope(String name);
 
     /**
      * Remove the given <i>statsLogger</i> for scope <i>name</i>.
@@ -71,6 +71,6 @@ public interface StatsLogger {
      * @param name name of the scope
      * @param statsLogger the stats logger of this scope.
      */
-    public void removeScope(String name, StatsLogger statsLogger);
+    void removeScope(String name, StatsLogger statsLogger);
 
 }
diff --git a/bookkeeper-stats/src/main/java/org/apache/bookkeeper/stats/StatsProvider.java b/bookkeeper-stats/src/main/java/org/apache/bookkeeper/stats/StatsProvider.java
index b06e0a6..6449e1f 100644
--- a/bookkeeper-stats/src/main/java/org/apache/bookkeeper/stats/StatsProvider.java
+++ b/bookkeeper-stats/src/main/java/org/apache/bookkeeper/stats/StatsProvider.java
@@ -28,18 +28,18 @@ public interface StatsProvider {
      * @param conf
      *          Configuration to configure the stats provider.
      */
-    public void start(Configuration conf);
+    void start(Configuration conf);
 
     /**
-     * Close the stats provider
+     * Close the stats provider.
      */
-    public void stop();
+    void stop();
 
     /**
-     * Return the stats logger to a given <i>scope</i>
+     * Return the stats logger to a given <i>scope</i>.
      * @param scope
      *          Scope for the given stats
      * @return stats logger for the given <i>scope</i>
      */
-    public StatsLogger getStatsLogger(String scope);
+    StatsLogger getStatsLogger(String scope);
 }
diff --git a/bookkeeper-stats/src/main/java/org/apache/bookkeeper/stats/NullStatsProvider.java b/bookkeeper-stats/src/main/java/org/apache/bookkeeper/stats/package-info.java
similarity index 63%
copy from bookkeeper-stats/src/main/java/org/apache/bookkeeper/stats/NullStatsProvider.java
copy to bookkeeper-stats/src/main/java/org/apache/bookkeeper/stats/package-info.java
index c817e74..d77aeda 100644
--- a/bookkeeper-stats/src/main/java/org/apache/bookkeeper/stats/NullStatsProvider.java
+++ b/bookkeeper-stats/src/main/java/org/apache/bookkeeper/stats/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 regarding copyright ownership. The ASF
@@ -14,27 +14,7 @@
  * License for the specific language governing permissions and limitations under
  * the License.
  */
-package org.apache.bookkeeper.stats;
-
-import org.apache.commons.configuration.Configuration;
-
-public class NullStatsProvider implements StatsProvider {
-
-    final StatsLogger nullStatsLogger = new NullStatsLogger();
-
-    @Override
-    public void start(Configuration conf) {
-        // nop
-    }
-
-    @Override
-    public void stop() {
-        // nop
-    }
-
-    @Override
-    public StatsLogger getStatsLogger(String scope) {
-        return nullStatsLogger;
-    }
-
-}
+/**
+ * @TODO: Write JavaDoc comment {@link https://github.com/apache/bookkepeer/issues/247}
+ */
+package org.apache.bookkeeper.stats;
\ No newline at end of file
diff --git a/checkstyle.xml b/checkstyle.xml
new file mode 100644
index 0000000..c644a40
--- /dev/null
+++ b/checkstyle.xml
@@ -0,0 +1,448 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+    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 regarding copyright ownership.
+    The ASF licenses this file 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
+
+       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.
+-->
+<!DOCTYPE module PUBLIC
+        "-//Puppy Crawl//DTD Check Configuration 1.3//EN"
+        "http://www.puppycrawl.com/dtds/configuration_1_3.dtd">
+
+<!-- This is a checkstyle configuration file. For descriptions of
+what the following rules do, please see the checkstyle configuration
+page at http://checkstyle.sourceforge.net/config.html -->
+
+<module name="Checker">
+
+    <module name="FileTabCharacter">
+        <!-- Checks that there are no tab characters in the file. -->
+    </module>
+
+    <module name="RegexpSingleline">
+        <!-- Checks that TODOs don't have stuff in parenthesis, e.g., username. -->
+        <property name="format" value="((//.*)|(\*.*))TODO\(" />
+        <property name="message" value="TODO comments must not include usernames." />
+        <property name="severity" value="error" />
+    </module>
+
+    <module name="RegexpSingleline">
+        <property name="format" value="\s+$"/>
+        <property name="message" value="Trailing whitespace"/>
+        <property name="severity" value="error"/>
+    </module>
+
+    <module name="RegexpSingleline">
+        <property name="format" value="Throwables.propagate\("/>
+        <property name="message" value="Throwables.propagate is deprecated"/>
+        <property name="severity" value="error"/>
+    </module>
+
+    <!-- Prevent *Tests.java as tools may not pick them up -->
+    <module name="RegexpOnFilename">
+        <property name="fileNamePattern" value=".*Tests\.java$" />
+    </module>
+
+    <!-- Allow use of comment to suppress javadocstyle -->
+    <module name="SuppressionCommentFilter">
+        <property name="offCommentFormat" value="CHECKSTYLE.OFF\: ([\w\|]+)"/>
+        <property name="onCommentFormat" value="CHECKSTYLE.ON\: ([\w\|]+)"/>
+        <property name="checkFormat" value="$1"/>
+    </module>
+    <module name="SuppressionFilter">
+        <property name="file" value="${checkstyle.suppressions.file}" default="suppressions.xml" />
+    </module>
+
+    <!-- Check that every module has a package-info.java -->
+    <module name="JavadocPackage"/>
+
+    <!-- All Java AST specific tests live under TreeWalker module. -->
+    <module name="TreeWalker">
+
+        <module name="TodoComment">
+            <!-- Checks that disallowed strings are not used in comments.  -->
+            <property name="format" value="(FIXME)|(XXX)|(@author)" />
+        </module>
+
+        <!--
+
+        IMPORT CHECKS
+
+        -->
+
+        <module name="RedundantImport">
+            <!-- Checks for redundant import statements. -->
+            <property name="severity" value="error"/>
+            <message key="import.redundancy"
+                     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. -->
+        <!--
+        <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"/>
+        </module>
+
+        <module name="IllegalImport">
+            <property name="illegalPkgs" value="autovalue.shaded, avro.shaded, bk-shade, com.google.api.client.repackaged, com.google.appengine.repackaged, io.netty.util.internal"/>
+        </module>
+
+        <module name="RedundantModifier">
+            <!-- Checks for redundant modifiers on various symbol definitions.
+              See: http://checkstyle.sourceforge.net/config_modifier.html#RedundantModifier
+            -->
+            <property name="tokens" value="METHOD_DEF, VARIABLE_DEF, ANNOTATION_FIELD_DEF, INTERFACE_DEF, CLASS_DEF, ENUM_DEF"/>
+        </module>
+
+        <!--
+            IllegalImport cannot blacklist classes, and c.g.api.client.util is used for some shaded
+            code and some useful code. So we need to fall back to Regexp.
+        -->
+        <module name="RegexpSinglelineJava">
+            <property name="format" value="com\.google\.api\.client\.util\.(ByteStreams|Charsets|Collections2|Joiner|Lists|Maps|Objects|Preconditions|Sets|Strings|Throwables)"/>
+        </module>
+
+        <!--
+             Require static importing from Preconditions.
+        -->
+        <module name="RegexpSinglelineJava">
+            <property name="format" value="^import com.google.common.base.Preconditions;$"/>
+            <property name="message" value="Static import functions from Guava Preconditions"/>
+        </module>
+
+        <module name="UnusedImports">
+            <property name="severity" value="error"/>
+            <property name="processJavadoc" value="true"/>
+            <message key="import.unused"
+                     value="Unused import: {0}."/>
+        </module>
+
+        <!--
+
+        JAVADOC CHECKS
+
+        -->
+
+        <!-- Checks for Javadoc comments.                     -->
+        <!-- See http://checkstyle.sf.net/config_javadoc.html -->
+        <module name="JavadocMethod">
+            <property name="scope" value="protected"/>
+            <property name="severity" value="error"/>
+            <property name="allowMissingJavadoc" value="true"/>
+            <property name="allowMissingParamTags" value="true"/>
+            <property name="allowMissingReturnTag" value="true"/>
+            <property name="allowMissingThrowsTags" value="true"/>
+            <property name="allowThrowsTagsForSubclasses" value="true"/>
+            <property name="allowUndeclaredRTE" value="true"/>
+        </module>
+
+        <!-- Check that paragraph tags are used correctly in Javadoc. -->
+        <module name="JavadocParagraph"/>
+
+        <module name="JavadocType">
+            <property name="scope" value="protected"/>
+            <property name="severity" value="error"/>
+            <property name="allowMissingParamTags" value="true"/>
+        </module>
+
+        <module name="JavadocStyle">
+            <property name="severity" value="error"/>
+            <property name="checkHtml" value="true"/>
+        </module>
+
+        <!--
+
+        NAMING CHECKS
+
+        -->
+
+        <!-- Item 38 - Adhere to generally accepted naming conventions -->
+
+        <module name="PackageName">
+            <!-- Validates identifiers for package names against the
+              supplied expression. -->
+            <!-- Here the default checkstyle rule restricts package name parts to
+              seven characters, this is not in line with common practice at Google.
+            -->
+            <property name="format" value="^[a-z]+(\.[a-z][a-z0-9]{1,})*$"/>
+            <property name="severity" value="error"/>
+        </module>
+
+        <module name="TypeNameCheck">
+            <!-- Validates static, final fields against the
+            expression "^[A-Z][a-zA-Z0-9]*$". -->
+            <metadata name="altname" value="TypeName"/>
+            <property name="severity" value="error"/>
+        </module>
+
+        <module name="ConstantNameCheck">
+            <!-- Validates non-private, static, final fields against the supplied
+            public/package final fields "^[A-Z][A-Z0-9]*(_[A-Z0-9]+)*$". -->
+            <metadata name="altname" value="ConstantName"/>
+            <property name="applyToPublic" value="true"/>
+            <property name="applyToProtected" value="true"/>
+            <property name="applyToPackage" value="true"/>
+            <property name="applyToPrivate" value="false"/>
+            <property name="format" value="^([A-Z][A-Za-z0-9_]*|FLAG_.*)$"/>
+            <message key="name.invalidPattern"
+                     value="Variable ''{0}'' should be in ALL_CAPS (if it is a constant) or be private (otherwise)."/>
+            <property name="severity" value="error"/>
+        </module>
+
+        <module name="StaticVariableNameCheck">
+            <!-- Validates static, non-final fields against the supplied
+            expression "^[a-z][a-zA-Z0-9]*_?$". -->
+            <metadata name="altname" value="StaticVariableName"/>
+            <property name="applyToPublic" value="true"/>
+            <property name="applyToProtected" value="true"/>
+            <property name="applyToPackage" value="true"/>
+            <property name="applyToPrivate" value="true"/>
+            <property name="format" value="^[a-z][a-zA-Z0-9]*_?$"/>
+            <property name="severity" value="error"/>
+        </module>
+
+        <module name="MemberNameCheck">
+            <!-- Validates non-static members against the supplied expression. -->
+            <metadata name="altname" value="MemberName"/>
+            <property name="applyToPublic" value="true"/>
+            <property name="applyToProtected" value="true"/>
+            <property name="applyToPackage" value="true"/>
+            <property name="applyToPrivate" value="true"/>
+            <property name="format" value="^[a-z][a-zA-Z0-9]*$"/>
+            <property name="severity" value="error"/>
+        </module>
+
+        <module name="MethodNameCheck">
+            <!-- Validates identifiers for method names. -->
+            <metadata name="altname" value="MethodName"/>
+            <property name="format" value="(^[a-z][a-zA-Z0-9]*(_[a-zA-Z0-9]+)*$|Void)"/>
+            <property name="severity" value="error"/>
+        </module>
+
+        <module name="ParameterName">
+            <!-- Validates identifiers for method parameters against the
+              expression "^[a-z][a-zA-Z0-9]*$". -->
+            <property name="severity" value="error"/>
+        </module>
+
+        <module name="LocalFinalVariableName">
+            <!-- Validates identifiers for local final variables against the
+              expression "^[a-z][a-zA-Z0-9]*$". -->
+            <property name="severity" value="error"/>
+        </module>
+
+        <module name="LocalVariableName">
+            <!-- Validates identifiers for local variables against the
+              expression "^[a-z][a-zA-Z0-9]*$". -->
+            <property name="severity" value="error"/>
+        </module>
+
+        <!-- Type parameters must be either one of the four blessed letters
+        T, K, V, W, X or else be capital-case terminated with a T,
+        such as MyGenericParameterT -->
+        <module name="ClassTypeParameterName">
+            <property name="format" value="^(((T|K|V|W|X|R)[0-9]*)|([A-Z][a-z][a-zA-Z]*))$"/>
+            <property name="severity" value="error"/>
+        </module>
+
+        <module name="MethodTypeParameterName">
+            <property name="format" value="^(((T|K|V|W|X|R)[0-9]*)|([A-Z][a-z][a-zA-Z]*T))$"/>
+            <property name="severity" value="error"/>
+        </module>
+
+        <module name="InterfaceTypeParameterName">
+            <property name="format" value="^(((T|K|V|W|X|R)[0-9]*)|([A-Z][a-z][a-zA-Z]*T))$"/>
+            <property name="severity" value="error"/>
+        </module>
+
+        <!--
+
+        LENGTH and CODING CHECKS
+
+        -->
+
+        <module name="LineLength">
+            <!-- Checks if a line is too long. -->
+            <property name="max" value="120"/>
+            <property name="severity" value="error"/>
+
+            <!--
+              The default ignore pattern exempts the following elements:
+                - import statements
+                - long URLs inside comments
+            -->
+
+            <property name="ignorePattern"
+                      value="^(package .*;\s*)|(import .*;\s*)|( *\* .*https?://.*)$"/>
+        </module>
+
+        <module name="LeftCurly">
+            <!-- Checks for placement of the left curly brace ('{'). -->
+            <property name="severity" value="error"/>
+        </module>
+
+        <module name="RightCurly">
+            <!-- Checks right curlies on CATCH, ELSE, and TRY blocks are on
+            the same line. e.g., the following example is fine:
+            <pre>
+              if {
+                ...
+              } else
+            </pre>
+            -->
+            <!-- This next example is not fine:
+            <pre>
+              if {
+                ...
+              }
+              else
+            </pre>
+            -->
+            <property name="option" value="same"/>
+            <property name="severity" value="error"/>
+        </module>
+
+        <!-- Checks for braces around if and else blocks -->
+        <module name="NeedBraces">
+            <property name="severity" value="error"/>
+            <property name="tokens" value="LITERAL_IF, LITERAL_ELSE, LITERAL_FOR, LITERAL_WHILE, LITERAL_DO"/>
+        </module>
+
+        <module name="UpperEll">
+            <!-- Checks that long constants are defined with an upper ell.-->
+            <property name="severity" value="error"/>
+        </module>
+
+        <module name="FallThrough">
+            <!-- Warn about falling through to the next case statement.  Similar to
+            javac -Xlint:fallthrough, but the check is suppressed if a single-line comment
+            on the last non-blank line preceding the fallen-into case contains 'fall through' (or
+            some other variants that we don't publicized to promote consistency).
+            -->
+            <property name="reliefPattern"
+                      value="fall through|Fall through|fallthru|Fallthru|falls through|Falls through|fallthrough|Fallthrough|No break|NO break|no break|continue on"/>
+            <property name="severity" value="error"/>
+        </module>
+
+        <!-- Checks for over-complicated boolean expressions. -->
+        <module name="SimplifyBooleanExpression"/>
+
+        <!-- Detects empty statements (standalone ";" semicolon). -->
+        <module name="EmptyStatement"/>
+
+        <!--
+
+        MODIFIERS CHECKS
+
+        -->
+
+        <module name="ModifierOrder">
+            <!-- Warn if modifier order is inconsistent with JLS3 8.1.1, 8.3.1, and
+                 8.4.3.  The prescribed order is:
+                 public, protected, private, abstract, static, final, transient, volatile,
+                 synchronized, native, strictfp
+              -->
+            <property name="severity" value="error"/>
+        </module>
+
+
+        <!--
+
+        WHITESPACE CHECKS
+
+        -->
+
+        <module name="WhitespaceAround">
+            <!-- Checks that various tokens are surrounded by whitespace.
+                 This includes most binary operators and keywords followed
+                 by regular or curly braces.
+            -->
+            <property name="tokens" value="ASSIGN, BAND, BAND_ASSIGN, BOR,
+        BOR_ASSIGN, BSR, BSR_ASSIGN, BXOR, BXOR_ASSIGN, COLON, DIV, DIV_ASSIGN,
+        EQUAL, GE, GT, LAND, LE, LITERAL_CATCH, LITERAL_DO, LITERAL_ELSE,
+        LITERAL_FINALLY, LITERAL_FOR, LITERAL_IF, LITERAL_RETURN,
+        LITERAL_SYNCHRONIZED, LITERAL_TRY, LITERAL_WHILE, LOR, LT, MINUS,
+        MINUS_ASSIGN, MOD, MOD_ASSIGN, NOT_EQUAL, PLUS, PLUS_ASSIGN, QUESTION,
+        SL, SL_ASSIGN, SR_ASSIGN, STAR, STAR_ASSIGN"/>
+            <property name="severity" value="error"/>
+        </module>
+
+        <module name="WhitespaceAfter">
+            <!-- Checks that commas, semicolons and typecasts are followed by
+                 whitespace.
+            -->
+            <property name="tokens" value="COMMA, SEMI, TYPECAST"/>
+        </module>
+
+        <module name="NoWhitespaceAfter">
+            <!-- Checks that there is no whitespace after various unary operators.
+                 Linebreaks are allowed.
+            -->
+            <property name="tokens" value="BNOT, DEC, DOT, INC, LNOT, UNARY_MINUS,
+        UNARY_PLUS"/>
+            <property name="allowLineBreaks" value="true"/>
+            <property name="severity" value="error"/>
+        </module>
+
+        <module name="NoWhitespaceBefore">
+            <!-- Checks that there is no whitespace before various unary operators.
+                 Linebreaks are allowed.
+            -->
+            <property name="tokens" value="SEMI, DOT, POST_DEC, POST_INC"/>
+            <property name="allowLineBreaks" value="true"/>
+            <property name="severity" value="error"/>
+        </module>
+
+        <module name="OperatorWrap">
+            <!-- Checks that operators like + and ? appear at newlines rather than
+                 at the end of the previous line.
+            -->
+            <property name="option" value="NL"/>
+            <property name="tokens" value="BAND, BOR, BSR, BXOR, DIV, EQUAL,
+        GE, GT, LAND, LE, LITERAL_INSTANCEOF, LOR, LT, MINUS, MOD,
+        NOT_EQUAL, PLUS, QUESTION, SL, SR, STAR "/>
+        </module>
+
+        <module name="OperatorWrap">
+            <!-- Checks that assignment operators are at the end of the line. -->
+            <property name="option" value="eol"/>
+            <property name="tokens" value="ASSIGN"/>
+        </module>
+
+        <module name="ParenPad">
+            <!-- Checks that there is no whitespace before close parens or after
+                 open parens.
+            -->
+            <property name="severity" value="error"/>
+        </module>
+
+        <!-- Required to support SuppressWarningsComment -->
+        <module name="FileContentsHolder"/>
+
+    </module>
+</module>
diff --git a/suppressions.xml b/suppressions.xml
new file mode 100644
index 0000000..e28dd40
--- /dev/null
+++ b/suppressions.xml
@@ -0,0 +1,28 @@
+<?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 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>

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

Mime
View raw message