Repository: bookkeeper
Updated Branches:
  refs/heads/master f3671fc9f -> f20568eaa


BOOKKEEPER-1007: Explicit LAC: make the interval configurable in ms

Author: eolivelli <[email protected]>

Reviewers: Robert (Bobby) Evans <None>, Venkateswararao Jujjuri (JV) <None>, 
Sijie Guo <[email protected]>

Closes #111 from eolivelli/BOOKKEEPER-1007-explicitlac-ms


Project: http://git-wip-us.apache.org/repos/asf/bookkeeper/repo
Commit: http://git-wip-us.apache.org/repos/asf/bookkeeper/commit/f20568ea
Tree: http://git-wip-us.apache.org/repos/asf/bookkeeper/tree/f20568ea
Diff: http://git-wip-us.apache.org/repos/asf/bookkeeper/diff/f20568ea

Branch: refs/heads/master
Commit: f20568eaa25e0efe6926ede9030a210382e3005b
Parents: f3671fc
Author: eolivelli <[email protected]>
Authored: Wed Mar 22 16:59:53 2017 -0700
Committer: Sijie Guo <[email protected]>
Committed: Wed Mar 22 16:59:53 2017 -0700

----------------------------------------------------------------------
 .../org/apache/bookkeeper/client/ExplicitLacFlushPolicy.java  | 7 +++----
 .../java/org/apache/bookkeeper/conf/ClientConfiguration.java  | 2 +-
 .../java/org/apache/bookkeeper/client/BookKeeperTest.java     | 2 +-
 3 files changed, 5 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/bookkeeper/blob/f20568ea/bookkeeper-server/src/main/java/org/apache/bookkeeper/client/ExplicitLacFlushPolicy.java
----------------------------------------------------------------------
diff --git 
a/bookkeeper-server/src/main/java/org/apache/bookkeeper/client/ExplicitLacFlushPolicy.java
 
b/bookkeeper-server/src/main/java/org/apache/bookkeeper/client/ExplicitLacFlushPolicy.java
index 65ef8af..e452b24 100644
--- 
a/bookkeeper-server/src/main/java/org/apache/bookkeeper/client/ExplicitLacFlushPolicy.java
+++ 
b/bookkeeper-server/src/main/java/org/apache/bookkeeper/client/ExplicitLacFlushPolicy.java
@@ -20,10 +20,9 @@
  */
 package org.apache.bookkeeper.client;
 
-import static java.util.concurrent.TimeUnit.SECONDS;
-
 import java.util.concurrent.RejectedExecutionException;
 import java.util.concurrent.ScheduledFuture;
+import java.util.concurrent.TimeUnit;
 
 import org.apache.bookkeeper.client.LedgerHandle.LastAddConfirmedCallback;
 import org.apache.bookkeeper.util.SafeRunnable;
@@ -79,7 +78,7 @@ interface ExplicitLacFlushPolicy {
         }
 
         private void scheduleExplictLacFlush() {
-            int explicitLacIntervalInSec = lh.bk.getExplicitLacInterval();
+            int explicitLacIntervalInMs = lh.bk.getExplicitLacInterval();
             final SafeRunnable updateLacTask = new SafeRunnable() {
                 @Override
                 public void safeRun() {
@@ -111,7 +110,7 @@ interface ExplicitLacFlushPolicy {
             };
             try {
                 scheduledFuture = 
lh.bk.mainWorkerPool.scheduleAtFixedRateOrdered(lh.getId(), updateLacTask,
-                        explicitLacIntervalInSec, explicitLacIntervalInSec, 
SECONDS);
+                        explicitLacIntervalInMs, explicitLacIntervalInMs, 
TimeUnit.MILLISECONDS);
             } catch (RejectedExecutionException re) {
                 LOG.error("Scheduling of ExplictLastAddConfirmedFlush for 
ledger: {} has failed because of {}",
                         lh.getId(), re);

http://git-wip-us.apache.org/repos/asf/bookkeeper/blob/f20568ea/bookkeeper-server/src/main/java/org/apache/bookkeeper/conf/ClientConfiguration.java
----------------------------------------------------------------------
diff --git 
a/bookkeeper-server/src/main/java/org/apache/bookkeeper/conf/ClientConfiguration.java
 
b/bookkeeper-server/src/main/java/org/apache/bookkeeper/conf/ClientConfiguration.java
index b73d2e2..b8554d4 100644
--- 
a/bookkeeper-server/src/main/java/org/apache/bookkeeper/conf/ClientConfiguration.java
+++ 
b/bookkeeper-server/src/main/java/org/apache/bookkeeper/conf/ClientConfiguration.java
@@ -611,7 +611,7 @@ public class ClientConfiguration extends 
AbstractConfiguration {
     /**
      * Set the interval to check the need for sending an explicit LAC.
      * @param interval
-     *        Number of seconds between checking the need for sending an 
explict LAC.
+     *        Number of milli seconds between checking the need for sending an 
explict LAC.
      * @return Client configuration.
      */
     public ClientConfiguration setExplictLacInterval(int interval) {

http://git-wip-us.apache.org/repos/asf/bookkeeper/blob/f20568ea/bookkeeper-server/src/test/java/org/apache/bookkeeper/client/BookKeeperTest.java
----------------------------------------------------------------------
diff --git 
a/bookkeeper-server/src/test/java/org/apache/bookkeeper/client/BookKeeperTest.java
 
b/bookkeeper-server/src/test/java/org/apache/bookkeeper/client/BookKeeperTest.java
index a2532c9..3719556 100644
--- 
a/bookkeeper-server/src/test/java/org/apache/bookkeeper/client/BookKeeperTest.java
+++ 
b/bookkeeper-server/src/test/java/org/apache/bookkeeper/client/BookKeeperTest.java
@@ -374,7 +374,7 @@ public class BookKeeperTest extends BaseTestCase {
     public void testReadHandleWithExplicitLAC() throws Exception {
         ClientConfiguration confWithExplicitLAC = new ClientConfiguration()
                 .setZkServers(zkUtil.getZooKeeperConnectString());
-        int explictLacInterval = 1;
+        int explictLacInterval = 1000;
         confWithExplicitLAC.setExplictLacInterval(explictLacInterval);
 
         BookKeeper bkcWithExplicitLAC = new BookKeeper(confWithExplicitLAC);

Reply via email to