You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kudu.apache.org by al...@apache.org on 2019/02/28 20:29:41 UTC

[kudu] 01/03: Rename DeadlineTracker to TimeoutTracker

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

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

commit 8fbf1cc2bbae3b9967e3c89bd20a254364d25edc
Author: Will Berkeley <wd...@gmail.org>
AuthorDate: Tue Feb 5 13:26:32 2019 -0800

    Rename DeadlineTracker to TimeoutTracker
    
    A deadline is the latest time by which something should be completed.
    It's an instant, like "next Tuesday at noon". A timeout is an interval
    of time allowed for some event to occur or be completed. It's a delta,
    like "15 minutes". The DeadlineTracker tracked a "relative deadline",
    relative to when the instance's "deadline" was set. That's actually a
    timeout. This patch harmonizes the names to the concepts.
    
    Change-Id: I3f465c925856390ecf4747e84bdd5a67c51c69eb
    Reviewed-on: http://gerrit.cloudera.org:8080/12373
    Reviewed-by: Alexey Serbin <as...@cloudera.com>
    Reviewed-by: Adar Dembo <ad...@cloudera.com>
    Tested-by: Will Berkeley <wd...@gmail.com>
---
 .../org/apache/kudu/client/AlterTableRequest.java  |   2 +-
 .../org/apache/kudu/client/AsyncKuduClient.java    |  38 ++---
 .../org/apache/kudu/client/AsyncKuduScanner.java   |   2 +-
 .../main/java/org/apache/kudu/client/Batch.java    |   6 +-
 .../java/org/apache/kudu/client/BatchResponse.java |   2 +-
 .../org/apache/kudu/client/ConnectToCluster.java   |   2 +-
 .../org/apache/kudu/client/CreateTableRequest.java |   2 +-
 .../org/apache/kudu/client/DeadlineTracker.java    | 159 ---------------------
 .../org/apache/kudu/client/DeleteTableRequest.java |   2 +-
 .../apache/kudu/client/GetTableSchemaRequest.java  |   2 +-
 .../kudu/client/IsAlterTableDoneRequest.java       |   2 +-
 .../kudu/client/IsCreateTableDoneRequest.java      |   2 +-
 .../org/apache/kudu/client/KuduPartitioner.java    |   6 +-
 .../main/java/org/apache/kudu/client/KuduRpc.java  |  10 +-
 .../org/apache/kudu/client/ListTablesRequest.java  |   2 +-
 .../kudu/client/ListTabletServersRequest.java      |   2 +-
 .../org/apache/kudu/client/ListTabletsRequest.java |   2 +-
 .../java/org/apache/kudu/client/Operation.java     |   6 +-
 .../java/org/apache/kudu/client/PingRequest.java   |   2 +-
 .../main/java/org/apache/kudu/client/RpcProxy.java |   4 +-
 .../org/apache/kudu/client/TimeoutTracker.java     | 159 +++++++++++++++++++++
 .../test/java/org/apache/kudu/client/ITClient.java |   8 +-
 .../apache/kudu/client/TestConnectionCache.java    |   6 +-
 ...eadlineTracker.java => TestTimeoutTracker.java} |  22 +--
 .../java/org/apache/kudu/test/KuduTestHarness.java |  11 +-
 .../org/apache/kudu/test/TestMiniKuduCluster.java  |   4 +-
 26 files changed, 232 insertions(+), 233 deletions(-)

diff --git a/java/kudu-client/src/main/java/org/apache/kudu/client/AlterTableRequest.java b/java/kudu-client/src/main/java/org/apache/kudu/client/AlterTableRequest.java
index 9e2dfd0..5734c67 100644
--- a/java/kudu-client/src/main/java/org/apache/kudu/client/AlterTableRequest.java
+++ b/java/kudu-client/src/main/java/org/apache/kudu/client/AlterTableRequest.java
@@ -80,7 +80,7 @@ class AlterTableRequest extends KuduRpc<AlterTableResponse> {
     final AlterTableResponsePB.Builder respBuilder = AlterTableResponsePB.newBuilder();
     readProtobuf(callResponse.getPBMessage(), respBuilder);
     AlterTableResponse response = new AlterTableResponse(
-        deadlineTracker.getElapsedMillis(),
+        timeoutTracker.getElapsedMillis(),
         tsUUID,
         respBuilder.hasTableId() ? respBuilder.getTableId().toStringUtf8() : null);
 
diff --git a/java/kudu-client/src/main/java/org/apache/kudu/client/AsyncKuduClient.java b/java/kudu-client/src/main/java/org/apache/kudu/client/AsyncKuduClient.java
index 20949a3..cf22d0a 100644
--- a/java/kudu-client/src/main/java/org/apache/kudu/client/AsyncKuduClient.java
+++ b/java/kudu-client/src/main/java/org/apache/kudu/client/AsyncKuduClient.java
@@ -978,7 +978,7 @@ public class AsyncKuduClient implements AutoCloseable {
       RecoverableException ex = (RecoverableException)arg;
       long sleepTime = getSleepTimeForRpcMillis(fakeRpc);
       if (cannotRetryRequest(fakeRpc) ||
-          fakeRpc.deadlineTracker.wouldSleepingTimeoutMillis(sleepTime)) {
+          fakeRpc.timeoutTracker.wouldSleepingTimeoutMillis(sleepTime)) {
         tooManyAttemptsOrTimeout(fakeRpc, ex); // invokes fakeRpc.Deferred
         return null;
       }
@@ -1579,7 +1579,7 @@ public class AsyncKuduClient implements AutoCloseable {
     }
 
     long sleepTimeMillis = getSleepTimeForRpcMillis(rpc);
-    if (rpc.deadlineTracker.wouldSleepingTimeoutMillis(sleepTimeMillis)) {
+    if (rpc.timeoutTracker.wouldSleepingTimeoutMillis(sleepTimeMillis)) {
       tooManyAttemptsOrTimeout(rpc, null);
       return;
     }
@@ -1609,7 +1609,7 @@ public class AsyncKuduClient implements AutoCloseable {
     }
 
     long sleepTimeMillis = getSleepTimeForRpcMillis(rpc);
-    if (rpc.deadlineTracker.wouldSleepingTimeoutMillis(sleepTimeMillis)) {
+    if (rpc.timeoutTracker.wouldSleepingTimeoutMillis(sleepTimeMillis)) {
       tooManyAttemptsOrTimeout(rpc, null);
       return;
     }
@@ -1664,7 +1664,7 @@ public class AsyncKuduClient implements AutoCloseable {
    * {@code false} otherwise (in which case it's OK to retry once more)
    */
   private static boolean cannotRetryRequest(final KuduRpc<?> rpc) {
-    return rpc.deadlineTracker.timedOut() || rpc.attempt > MAX_RPC_ATTEMPTS;
+    return rpc.timeoutTracker.timedOut() || rpc.attempt > MAX_RPC_ATTEMPTS;
   }
 
   /**
@@ -1722,7 +1722,7 @@ public class AsyncKuduClient implements AutoCloseable {
       d = getMasterTableLocationsPB(parentRpc);
     } else {
       long timeoutMillis = parentRpc == null ? defaultAdminOperationTimeoutMs :
-                                               parentRpc.deadlineTracker.getMillisBeforeDeadline();
+                                               parentRpc.timeoutTracker.getMillisBeforeTimeout();
       // Leave the end of the partition key range empty in order to pre-fetch tablet locations.
       GetTableLocationsRequest rpc =
           new GetTableLocationsRequest(masterTable,
@@ -1818,7 +1818,7 @@ public class AsyncKuduClient implements AutoCloseable {
                                                         final byte[] endPartitionKey,
                                                         final int fetchBatchSize,
                                                         final List<LocatedTablet> ret,
-                                                        final DeadlineTracker deadlineTracker) {
+                                                        final TimeoutTracker timeoutTracker) {
     // We rely on the keys initially not being empty.
     Preconditions.checkArgument(startPartitionKey == null || startPartitionKey.length > 0,
                                 "use null for unbounded start partition key");
@@ -1846,9 +1846,9 @@ public class AsyncKuduClient implements AutoCloseable {
         continue;
       }
 
-      if (deadlineTracker.timedOut()) {
+      if (timeoutTracker.timedOut()) {
         Status statusTimedOut = Status.TimedOut("Took too long getting the list of tablets, " +
-            deadlineTracker);
+            timeoutTracker);
         return Deferred.fromError(new NonRecoverableException(statusTimedOut));
       }
 
@@ -1861,7 +1861,7 @@ public class AsyncKuduClient implements AutoCloseable {
       // Build a fake RPC to encapsulate and propagate the timeout. There's no actual "RPC" to send.
       KuduRpc fakeRpc = buildFakeRpc("loopLocateTable",
                                      null,
-                                     deadlineTracker.getMillisBeforeDeadline());
+                                     timeoutTracker.getMillisBeforeTimeout());
 
       return locateTablet(table, key, fetchBatchSize, fakeRpc).addCallbackDeferring(
           new Callback<Deferred<List<LocatedTablet>>, GetTableLocationsResponsePB>() {
@@ -1872,7 +1872,7 @@ public class AsyncKuduClient implements AutoCloseable {
                                      endPartitionKey,
                                      fetchBatchSize,
                                      ret,
-                                     deadlineTracker);
+                  timeoutTracker);
             }
 
             @Override
@@ -1904,14 +1904,14 @@ public class AsyncKuduClient implements AutoCloseable {
                                             int fetchBatchSize,
                                             long deadline) {
     final List<LocatedTablet> ret = Lists.newArrayList();
-    final DeadlineTracker deadlineTracker = new DeadlineTracker();
-    deadlineTracker.setDeadline(deadline);
+    final TimeoutTracker timeoutTracker = new TimeoutTracker();
+    timeoutTracker.setTimeout(deadline);
     return loopLocateTable(table,
                            startPartitionKey,
                            endPartitionKey,
                            fetchBatchSize,
                            ret,
-                           deadlineTracker);
+        timeoutTracker);
   }
 
   /**
@@ -1998,7 +1998,7 @@ public class AsyncKuduClient implements AutoCloseable {
 
     long sleepTime = getSleepTimeForRpcMillis(rpc);
     if (cannotRetryRequest(rpc) ||
-        rpc.deadlineTracker.wouldSleepingTimeoutMillis(sleepTime)) {
+        rpc.timeoutTracker.wouldSleepingTimeoutMillis(sleepTime)) {
       // Don't let it retry.
       return tooManyAttemptsOrTimeout(rpc, ex);
     }
@@ -2215,7 +2215,7 @@ public class AsyncKuduClient implements AutoCloseable {
   Deferred<LocatedTablet> getTabletLocation(final KuduTable table,
                                             final byte[] partitionKey,
                                             final LookupType lookupType,
-                                            long deadline) {
+                                            long timeout) {
 
     // Locate the tablet at the partition key by locating tablets between
     // the partition key (inclusive), and the incremented partition key (exclusive).
@@ -2230,10 +2230,10 @@ public class AsyncKuduClient implements AutoCloseable {
       endPartitionKey = Arrays.copyOf(partitionKey, partitionKey.length + 1);
     }
 
-    final DeadlineTracker deadlineTracker = new DeadlineTracker();
-    deadlineTracker.setDeadline(deadline);
+    final TimeoutTracker timeoutTracker = new TimeoutTracker();
+    timeoutTracker.setTimeout(timeout);
     Deferred<List<LocatedTablet>> locatedTablets = locateTable(
-        table, startPartitionKey, endPartitionKey, FETCH_TABLETS_PER_POINT_LOOKUP, deadline);
+        table, startPartitionKey, endPartitionKey, FETCH_TABLETS_PER_POINT_LOOKUP, timeout);
 
     // Then pick out the single tablet result from the list.
     return locatedTablets.addCallbackDeferring(
@@ -2265,7 +2265,7 @@ public class AsyncKuduClient implements AutoCloseable {
                 // This is a LOWER_BOUND lookup, get the tablet location from the upper bound key
                 // of the non-covered range to return the next valid tablet location.
                 return getTabletLocation(table, entry.getUpperBoundPartitionKey(),
-                    LookupType.POINT, deadlineTracker.getMillisBeforeDeadline());
+                    LookupType.POINT, timeoutTracker.getMillisBeforeTimeout());
               }
               return Deferred.fromResult(new LocatedTablet(entry.getTablet()));
             }
diff --git a/java/kudu-client/src/main/java/org/apache/kudu/client/AsyncKuduScanner.java b/java/kudu-client/src/main/java/org/apache/kudu/client/AsyncKuduScanner.java
index 15668d1..93bafb8 100644
--- a/java/kudu-client/src/main/java/org/apache/kudu/client/AsyncKuduScanner.java
+++ b/java/kudu-client/src/main/java/org/apache/kudu/client/AsyncKuduScanner.java
@@ -1021,7 +1021,7 @@ public final class AsyncKuduScanner {
         }
       }
       RowResultIterator iterator = RowResultIterator.makeRowResultIterator(
-          deadlineTracker.getElapsedMillis(), tsUUID, schema, resp.getData(), callResponse);
+          timeoutTracker.getElapsedMillis(), tsUUID, schema, resp.getData(), callResponse);
 
       boolean hasMore = resp.getHasMoreResults();
       if (id.length != 0 && scannerId != null && !Bytes.equals(scannerId, id)) {
diff --git a/java/kudu-client/src/main/java/org/apache/kudu/client/Batch.java b/java/kudu-client/src/main/java/org/apache/kudu/client/Batch.java
index a89374e..b08e246 100644
--- a/java/kudu-client/src/main/java/org/apache/kudu/client/Batch.java
+++ b/java/kudu-client/src/main/java/org/apache/kudu/client/Batch.java
@@ -73,8 +73,8 @@ class Batch extends KuduRpc<BatchResponse> {
    * @param timeoutMillis the new timeout of the batch in milliseconds
    */
   void resetTimeoutMillis(Timer timer, long timeoutMillis) {
-    deadlineTracker.reset();
-    deadlineTracker.setDeadline(timeoutMillis);
+    timeoutTracker.reset();
+    timeoutTracker.setTimeout(timeoutMillis);
     if (timeoutTask != null) {
       timeoutTask.cancel();
     }
@@ -145,7 +145,7 @@ class Batch extends KuduRpc<BatchResponse> {
       }
     }
 
-    BatchResponse response = new BatchResponse(deadlineTracker.getElapsedMillis(),
+    BatchResponse response = new BatchResponse(timeoutTracker.getElapsedMillis(),
                                                tsUUID,
                                                builder.getTimestamp(),
                                                errorsPB,
diff --git a/java/kudu-client/src/main/java/org/apache/kudu/client/BatchResponse.java b/java/kudu-client/src/main/java/org/apache/kudu/client/BatchResponse.java
index 408c4cd..24078eb 100644
--- a/java/kudu-client/src/main/java/org/apache/kudu/client/BatchResponse.java
+++ b/java/kudu-client/src/main/java/org/apache/kudu/client/BatchResponse.java
@@ -78,7 +78,7 @@ public class BatchResponse extends KuduRpcResponse {
         currentErrorIndex++;
       }
       individualResponses.add(
-          new OperationResponse(currentOperation.deadlineTracker.getElapsedMillis(),
+          new OperationResponse(currentOperation.timeoutTracker.getElapsedMillis(),
                                 tsUUID,
                                 writeTimestamp,
                                 currentOperation,
diff --git a/java/kudu-client/src/main/java/org/apache/kudu/client/ConnectToCluster.java b/java/kudu-client/src/main/java/org/apache/kudu/client/ConnectToCluster.java
index 1ee9767..0557b56 100644
--- a/java/kudu-client/src/main/java/org/apache/kudu/client/ConnectToCluster.java
+++ b/java/kudu-client/src/main/java/org/apache/kudu/client/ConnectToCluster.java
@@ -100,7 +100,7 @@ final class ConnectToCluster {
     // TODO: Handle the situation when multiple in-flight RPCs all want to query the masters,
     // basically reuse in some way the master permits.
     long timeoutMillis = parentRpc == null ? defaultTimeoutMs :
-                                             parentRpc.deadlineTracker.getMillisBeforeDeadline();
+                                             parentRpc.timeoutTracker.getMillisBeforeTimeout();
     final ConnectToMasterRequest rpc = new ConnectToMasterRequest(masterTable, timer, timeoutMillis);
     rpc.setParentRpc(parentRpc);
     Deferred<ConnectToMasterResponsePB> d = rpc.getDeferred();
diff --git a/java/kudu-client/src/main/java/org/apache/kudu/client/CreateTableRequest.java b/java/kudu-client/src/main/java/org/apache/kudu/client/CreateTableRequest.java
index f1d5f20..c270f82 100644
--- a/java/kudu-client/src/main/java/org/apache/kudu/client/CreateTableRequest.java
+++ b/java/kudu-client/src/main/java/org/apache/kudu/client/CreateTableRequest.java
@@ -78,7 +78,7 @@ class CreateTableRequest extends KuduRpc<CreateTableResponse> {
     readProtobuf(callResponse.getPBMessage(), builder);
     CreateTableResponse response =
         new CreateTableResponse(
-            deadlineTracker.getElapsedMillis(),
+            timeoutTracker.getElapsedMillis(),
             tsUUID,
             builder.getTableId().toStringUtf8());
     return new Pair<CreateTableResponse, Object>(
diff --git a/java/kudu-client/src/main/java/org/apache/kudu/client/DeadlineTracker.java b/java/kudu-client/src/main/java/org/apache/kudu/client/DeadlineTracker.java
deleted file mode 100644
index ec2d6e9..0000000
--- a/java/kudu-client/src/main/java/org/apache/kudu/client/DeadlineTracker.java
+++ /dev/null
@@ -1,159 +0,0 @@
-// 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.
-
-package org.apache.kudu.client;
-
-import java.util.concurrent.TimeUnit;
-
-import com.google.common.base.Stopwatch;
-
-/**
- * This is a wrapper class around {@link com.google.common.base.Stopwatch} used to track a relative
- * deadline in the future.
- * <p>
- * The watch starts as soon as this object is created with a deadline of 0,
- * meaning that there's no deadline.
- * The deadline has been reached once the stopwatch's elapsed time is equal or greater than the
- * provided deadline.
- */
-public class DeadlineTracker {
-  private final Stopwatch stopwatch;
-  /** relative deadline in milliseconds **/
-  private long deadline = 0;
-
-  /**
-   * Creates a new tracker, which starts the stopwatch right now.
-   */
-  public DeadlineTracker() {
-    this(Stopwatch.createUnstarted());
-  }
-
-  /**
-   * Creates a new tracker, using the specified stopwatch, and starts it right now.
-   * The stopwatch is reset if it was already running.
-   * @param stopwatch Specific Stopwatch to use
-   */
-  public DeadlineTracker(Stopwatch stopwatch) {
-    if (stopwatch.isRunning()) {
-      stopwatch.reset();
-    }
-    this.stopwatch = stopwatch.start();
-  }
-
-  /**
-   * Check if we're already past the deadline.
-   * @return true if we're past the deadline, otherwise false. Also returns false if no deadline
-   * was specified
-   */
-  public boolean timedOut() {
-    if (!hasDeadline()) {
-      return false;
-    }
-    return deadline - stopwatch.elapsed(TimeUnit.MILLISECONDS) <= 0;
-  }
-
-  /**
-   * Get the number of milliseconds before the deadline is reached.
-   * <p>
-   * This method is used to pass down the remaining deadline to the RPCs, so has special semantics.
-   * A deadline of 0 is used to indicate an infinite deadline, and negative deadlines are invalid.
-   * Thus, if the deadline has passed (i.e. <tt>deadline - stopwatch.elapsedMillis() &lt;= 0</tt>),
-   * the returned value is floored at <tt>1</tt>.
-   * <p>
-   * Callers who care about this behavior should first check {@link #timedOut()}.
-   *
-   * @return the remaining millis before the deadline is reached, or 1 if the remaining time is
-   * lesser or equal to 0, or Long.MAX_VALUE if no deadline was specified (in which case it
-   * should never be called).
-   * @throws IllegalStateException if this method is called and no deadline was set
-   */
-  public long getMillisBeforeDeadline() {
-    if (!hasDeadline()) {
-      throw new IllegalStateException("This tracker doesn't have a deadline set so it cannot " +
-          "answer getMillisBeforeDeadline()");
-    }
-    long millisBeforeDeadline = deadline - stopwatch.elapsed(TimeUnit.MILLISECONDS);
-    millisBeforeDeadline = millisBeforeDeadline <= 0 ? 1 : millisBeforeDeadline;
-    return millisBeforeDeadline;
-  }
-
-  public long getElapsedMillis() {
-    return this.stopwatch.elapsed(TimeUnit.MILLISECONDS);
-  }
-
-  /**
-   * Tells if a non-zero deadline was set.
-   * @return true if the deadline is greater than 0, false otherwise.
-   */
-  public boolean hasDeadline() {
-    return deadline != 0;
-  }
-
-  /**
-   * Utility method to check if sleeping for a specified amount of time would put us past the
-   * deadline.
-   * @param plannedSleepTimeMillis number of milliseconds for a planned sleep
-   * @return if the planned sleeps goes past the deadline.
-   */
-  public boolean wouldSleepingTimeoutMillis(long plannedSleepTimeMillis) {
-    if (!hasDeadline()) {
-      return false;
-    }
-    return getMillisBeforeDeadline() - plannedSleepTimeMillis <= 0;
-  }
-
-  /**
-   * Sets the deadline to 0 (no deadline) and restarts the stopwatch from scratch.
-   */
-  public void reset() {
-    deadline = 0;
-    stopwatch.reset();
-    stopwatch.start();
-  }
-
-  /**
-   * Get the deadline (in milliseconds).
-   * @return the current deadline
-   */
-  public long getDeadline() {
-    return deadline;
-  }
-
-  /**
-   * Set a new deadline for this tracker. It cannot be smaller than 0,
-   * and if it is 0 then it means that there is no deadline (which is the default behavior).
-   * This method won't call reset().
-   * @param deadline a number of milliseconds greater or equal to 0
-   * @throws IllegalArgumentException if the deadline is lesser than 0
-   */
-  public void setDeadline(long deadline) {
-    if (deadline < 0) {
-      throw new IllegalArgumentException("The deadline must be greater or equal to 0, " +
-          "the passed value is " + deadline);
-    }
-    this.deadline = deadline;
-  }
-
-  @Override
-  public String toString() {
-    StringBuilder buf = new StringBuilder("DeadlineTracker(timeout=");
-    buf.append(deadline);
-    buf.append(", elapsed=").append(stopwatch.elapsed(TimeUnit.MILLISECONDS));
-    buf.append(")");
-    return buf.toString();
-  }
-}
diff --git a/java/kudu-client/src/main/java/org/apache/kudu/client/DeleteTableRequest.java b/java/kudu-client/src/main/java/org/apache/kudu/client/DeleteTableRequest.java
index 80c207d..dd8f1fc 100644
--- a/java/kudu-client/src/main/java/org/apache/kudu/client/DeleteTableRequest.java
+++ b/java/kudu-client/src/main/java/org/apache/kudu/client/DeleteTableRequest.java
@@ -67,7 +67,7 @@ class DeleteTableRequest extends KuduRpc<DeleteTableResponse> {
     final Master.DeleteTableResponsePB.Builder builder = Master.DeleteTableResponsePB.newBuilder();
     readProtobuf(callResponse.getPBMessage(), builder);
     DeleteTableResponse response =
-        new DeleteTableResponse(deadlineTracker.getElapsedMillis(), tsUUID);
+        new DeleteTableResponse(timeoutTracker.getElapsedMillis(), tsUUID);
     return new Pair<DeleteTableResponse, Object>(
         response, builder.hasError() ? builder.getError() : null);
   }
diff --git a/java/kudu-client/src/main/java/org/apache/kudu/client/GetTableSchemaRequest.java b/java/kudu-client/src/main/java/org/apache/kudu/client/GetTableSchemaRequest.java
index 93671bf..d3e48e6 100644
--- a/java/kudu-client/src/main/java/org/apache/kudu/client/GetTableSchemaRequest.java
+++ b/java/kudu-client/src/main/java/org/apache/kudu/client/GetTableSchemaRequest.java
@@ -84,7 +84,7 @@ public class GetTableSchemaRequest extends KuduRpc<GetTableSchemaResponse> {
     readProtobuf(callResponse.getPBMessage(), respBuilder);
     Schema schema = ProtobufHelper.pbToSchema(respBuilder.getSchema());
     GetTableSchemaResponse response = new GetTableSchemaResponse(
-        deadlineTracker.getElapsedMillis(),
+        timeoutTracker.getElapsedMillis(),
         tsUUID,
         schema,
         respBuilder.getTableId().toStringUtf8(),
diff --git a/java/kudu-client/src/main/java/org/apache/kudu/client/IsAlterTableDoneRequest.java b/java/kudu-client/src/main/java/org/apache/kudu/client/IsAlterTableDoneRequest.java
index 2866faf..2bce8a1 100644
--- a/java/kudu-client/src/main/java/org/apache/kudu/client/IsAlterTableDoneRequest.java
+++ b/java/kudu-client/src/main/java/org/apache/kudu/client/IsAlterTableDoneRequest.java
@@ -65,7 +65,7 @@ class IsAlterTableDoneRequest extends KuduRpc<IsAlterTableDoneResponse> {
                                                        String tsUUID) throws KuduException {
     final IsAlterTableDoneResponsePB.Builder respBuilder = IsAlterTableDoneResponsePB.newBuilder();
     readProtobuf(callResponse.getPBMessage(), respBuilder);
-    IsAlterTableDoneResponse resp = new IsAlterTableDoneResponse(deadlineTracker.getElapsedMillis(),
+    IsAlterTableDoneResponse resp = new IsAlterTableDoneResponse(timeoutTracker.getElapsedMillis(),
                                                                  tsUUID,
                                                                  respBuilder.getDone());
     return new Pair<IsAlterTableDoneResponse, Object>(
diff --git a/java/kudu-client/src/main/java/org/apache/kudu/client/IsCreateTableDoneRequest.java b/java/kudu-client/src/main/java/org/apache/kudu/client/IsCreateTableDoneRequest.java
index 2fd0290..76ca70a 100644
--- a/java/kudu-client/src/main/java/org/apache/kudu/client/IsCreateTableDoneRequest.java
+++ b/java/kudu-client/src/main/java/org/apache/kudu/client/IsCreateTableDoneRequest.java
@@ -58,7 +58,7 @@ class IsCreateTableDoneRequest extends KuduRpc<IsCreateTableDoneResponse> {
         IsCreateTableDoneResponsePB.newBuilder();
     readProtobuf(callResponse.getPBMessage(), builder);
     IsCreateTableDoneResponse resp =
-        new IsCreateTableDoneResponse(deadlineTracker.getElapsedMillis(),
+        new IsCreateTableDoneResponse(timeoutTracker.getElapsedMillis(),
                                       tsUUID,
                                       builder.getDone());
     return new Pair<IsCreateTableDoneResponse, Object>(
diff --git a/java/kudu-client/src/main/java/org/apache/kudu/client/KuduPartitioner.java b/java/kudu-client/src/main/java/org/apache/kudu/client/KuduPartitioner.java
index bdadea1..9dba46c 100644
--- a/java/kudu-client/src/main/java/org/apache/kudu/client/KuduPartitioner.java
+++ b/java/kudu-client/src/main/java/org/apache/kudu/client/KuduPartitioner.java
@@ -143,8 +143,8 @@ public class KuduPartitioner {
      * @return a new {@link KuduPartitioner}
      */
     public KuduPartitioner build() throws KuduException {
-      final DeadlineTracker deadlineTracker = new DeadlineTracker();
-      deadlineTracker.setDeadline(timeoutMillis);
+      final TimeoutTracker timeoutTracker = new TimeoutTracker();
+      timeoutTracker.setTimeout(timeoutMillis);
       NavigableMap<BytesKey, Integer> partitionByStartKey = new TreeMap<>();
       // Insert a sentinel for the beginning of the table, in case a user
       // queries for any row which falls before the first partition.
@@ -157,7 +157,7 @@ public class KuduPartitioner {
           tablet = KuduClient.joinAndHandleException(
               table.getAsyncClient().getTabletLocation(table,
                   nextPartKey.bytes, AsyncKuduClient.LookupType.LOWER_BOUND,
-                  deadlineTracker.getMillisBeforeDeadline()));
+                  timeoutTracker.getMillisBeforeTimeout()));
         } catch (NonCoveredRangeException ncr) {
           // No more tablets
           break;
diff --git a/java/kudu-client/src/main/java/org/apache/kudu/client/KuduRpc.java b/java/kudu-client/src/main/java/org/apache/kudu/client/KuduRpc.java
index 3d212ee..eb33c80 100644
--- a/java/kudu-client/src/main/java/org/apache/kudu/client/KuduRpc.java
+++ b/java/kudu-client/src/main/java/org/apache/kudu/client/KuduRpc.java
@@ -130,7 +130,7 @@ public abstract class KuduRpc<R> {
 
   final KuduTable table;
 
-  final DeadlineTracker deadlineTracker;
+  final TimeoutTracker timeoutTracker;
 
   // 'timeoutTask' is a handle to the timer task that will time out the RPC. It is
   // null if and only if the task has no timeout.
@@ -155,8 +155,8 @@ public abstract class KuduRpc<R> {
 
   KuduRpc(KuduTable table, Timer timer, long timeoutMillis) {
     this.table = table;
-    this.deadlineTracker = new DeadlineTracker();
-    deadlineTracker.setDeadline(timeoutMillis);
+    this.timeoutTracker = new TimeoutTracker();
+    timeoutTracker.setTimeout(timeoutMillis);
     if (timer != null) {
       this.timeoutTask = AsyncKuduClient.newTimeout(timer,
                                                     new RpcTimeoutTask(),
@@ -257,7 +257,7 @@ public abstract class KuduRpc<R> {
     if (timeoutTask != null) {
       timeoutTask.cancel();
     }
-    deadlineTracker.reset();
+    timeoutTracker.reset();
     traces.clear();
     parentRpc = null;
     d.callback(result);
@@ -383,7 +383,7 @@ public abstract class KuduRpc<R> {
       buf.append(tablet.getTabletId());
     }
     buf.append(", attempt=").append(attempt);
-    buf.append(", ").append(deadlineTracker);
+    buf.append(", ").append(timeoutTracker);
     buf.append(", ").append(RpcTraceFrame.getHumanReadableStringForTraces(traces));
     // Cheating a bit, we're not actually logging but we'll augment the information provided by
     // this method if DEBUG is enabled.
diff --git a/java/kudu-client/src/main/java/org/apache/kudu/client/ListTablesRequest.java b/java/kudu-client/src/main/java/org/apache/kudu/client/ListTablesRequest.java
index e7416df..a0e43a7 100644
--- a/java/kudu-client/src/main/java/org/apache/kudu/client/ListTablesRequest.java
+++ b/java/kudu-client/src/main/java/org/apache/kudu/client/ListTablesRequest.java
@@ -71,7 +71,7 @@ class ListTablesRequest extends KuduRpc<ListTablesResponse> {
     for (Master.ListTablesResponsePB.TableInfo info : respBuilder.getTablesList()) {
       tables.add(info.getName());
     }
-    ListTablesResponse response = new ListTablesResponse(deadlineTracker.getElapsedMillis(),
+    ListTablesResponse response = new ListTablesResponse(timeoutTracker.getElapsedMillis(),
                                                          tsUUID,
                                                          tables);
     return new Pair<ListTablesResponse, Object>(
diff --git a/java/kudu-client/src/main/java/org/apache/kudu/client/ListTabletServersRequest.java b/java/kudu-client/src/main/java/org/apache/kudu/client/ListTabletServersRequest.java
index 75e62fb..53d8277 100644
--- a/java/kudu-client/src/main/java/org/apache/kudu/client/ListTabletServersRequest.java
+++ b/java/kudu-client/src/main/java/org/apache/kudu/client/ListTabletServersRequest.java
@@ -65,7 +65,7 @@ public class ListTabletServersRequest extends KuduRpc<ListTabletServersResponse>
       servers.add(entry.getRegistration().getRpcAddresses(0).getHost());
     }
     ListTabletServersResponse response =
-        new ListTabletServersResponse(deadlineTracker.getElapsedMillis(),
+        new ListTabletServersResponse(timeoutTracker.getElapsedMillis(),
                                       tsUUID,
                                       serversCount,
                                       servers);
diff --git a/java/kudu-client/src/main/java/org/apache/kudu/client/ListTabletsRequest.java b/java/kudu-client/src/main/java/org/apache/kudu/client/ListTabletsRequest.java
index a6d4ff3..0645549 100644
--- a/java/kudu-client/src/main/java/org/apache/kudu/client/ListTabletsRequest.java
+++ b/java/kudu-client/src/main/java/org/apache/kudu/client/ListTabletsRequest.java
@@ -61,7 +61,7 @@ class ListTabletsRequest extends KuduRpc<ListTabletsResponse> {
         : respBuilder.getStatusAndSchemaList()) {
       tablets.add(info.getTabletStatus().getTabletId());
     }
-    ListTabletsResponse response = new ListTabletsResponse(deadlineTracker.getElapsedMillis(),
+    ListTabletsResponse response = new ListTabletsResponse(timeoutTracker.getElapsedMillis(),
                                                            tsUUID,
                                                            tablets);
     return new Pair<ListTabletsResponse, Object>(
diff --git a/java/kudu-client/src/main/java/org/apache/kudu/client/Operation.java b/java/kudu-client/src/main/java/org/apache/kudu/client/Operation.java
index a585c72..38ba205 100644
--- a/java/kudu-client/src/main/java/org/apache/kudu/client/Operation.java
+++ b/java/kudu-client/src/main/java/org/apache/kudu/client/Operation.java
@@ -107,8 +107,8 @@ public abstract class Operation extends KuduRpc<OperationResponse> {
    * @param timeoutMillis the new timeout of the batch in milliseconds
    */
   void resetTimeoutMillis(Timer timer, long timeoutMillis) {
-    deadlineTracker.reset();
-    deadlineTracker.setDeadline(timeoutMillis);
+    timeoutTracker.reset();
+    timeoutTracker.setTimeout(timeoutMillis);
     if (timeoutTask != null) {
       timeoutTask.cancel();
     }
@@ -175,7 +175,7 @@ public abstract class Operation extends KuduRpc<OperationResponse> {
         error = null;
       }
     }
-    OperationResponse response = new OperationResponse(deadlineTracker.getElapsedMillis(),
+    OperationResponse response = new OperationResponse(timeoutTracker.getElapsedMillis(),
                                                        tsUUID,
                                                        builder.getTimestamp(),
                                                        this,
diff --git a/java/kudu-client/src/main/java/org/apache/kudu/client/PingRequest.java b/java/kudu-client/src/main/java/org/apache/kudu/client/PingRequest.java
index d536998..877a571 100644
--- a/java/kudu-client/src/main/java/org/apache/kudu/client/PingRequest.java
+++ b/java/kudu-client/src/main/java/org/apache/kudu/client/PingRequest.java
@@ -68,7 +68,7 @@ class PingRequest extends KuduRpc<PingResponse> {
     final Master.PingResponsePB.Builder respBuilder =
         Master.PingResponsePB.newBuilder();
     readProtobuf(callResponse.getPBMessage(), respBuilder);
-    PingResponse response = new PingResponse(deadlineTracker.getElapsedMillis(), tsUUID);
+    PingResponse response = new PingResponse(timeoutTracker.getElapsedMillis(), tsUUID);
     return new Pair<>(response, null);
   }
 }
diff --git a/java/kudu-client/src/main/java/org/apache/kudu/client/RpcProxy.java b/java/kudu-client/src/main/java/org/apache/kudu/client/RpcProxy.java
index d95a27c..8419437 100644
--- a/java/kudu-client/src/main/java/org/apache/kudu/client/RpcProxy.java
+++ b/java/kudu-client/src/main/java/org/apache/kudu/client/RpcProxy.java
@@ -183,8 +183,8 @@ class RpcProxy {
                 .setMethodName(rpc.method()));
     final Message reqPB = rpc.createRequestPB();
     // TODO(wdberkeley): We should enforce that every RPC has a timeout.
-    if (rpc.deadlineTracker.hasDeadline()) {
-      headerBuilder.setTimeoutMillis((int) rpc.deadlineTracker.getMillisBeforeDeadline());
+    if (rpc.timeoutTracker.hasTimeout()) {
+      headerBuilder.setTimeoutMillis((int) rpc.timeoutTracker.getMillisBeforeTimeout());
     }
     if (rpc.isRequestTracked()) {
       RpcHeader.RequestIdPB.Builder requestIdBuilder = RpcHeader.RequestIdPB.newBuilder();
diff --git a/java/kudu-client/src/main/java/org/apache/kudu/client/TimeoutTracker.java b/java/kudu-client/src/main/java/org/apache/kudu/client/TimeoutTracker.java
new file mode 100644
index 0000000..0e99c0f
--- /dev/null
+++ b/java/kudu-client/src/main/java/org/apache/kudu/client/TimeoutTracker.java
@@ -0,0 +1,159 @@
+// 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.
+
+package org.apache.kudu.client;
+
+import java.util.concurrent.TimeUnit;
+
+import com.google.common.base.Stopwatch;
+
+/**
+ * This is a wrapper class around {@link com.google.common.base.Stopwatch} used to track a timeout
+ * in the future.
+ * <p>
+ * The watch starts as soon as this object is created with a timeout of 0, which means that
+ * there's no timeout.
+ * The timeout has been reached once the stopwatch's elapsed time is equal or greater than the
+ * provided timeout.
+ */
+public class TimeoutTracker {
+  private final Stopwatch stopwatch;
+  /** timeout in milliseconds **/
+  private long timeout = 0;
+
+  /**
+   * Creates a new tracker, which starts the stopwatch right now.
+   */
+  public TimeoutTracker() {
+    this(Stopwatch.createUnstarted());
+  }
+
+  /**
+   * Creates a new tracker, using the specified stopwatch, and starts it right now.
+   * The stopwatch is reset if it was already running.
+   * @param stopwatch Specific Stopwatch to use
+   */
+  public TimeoutTracker(Stopwatch stopwatch) {
+    if (stopwatch.isRunning()) {
+      stopwatch.reset();
+    }
+    this.stopwatch = stopwatch.start();
+  }
+
+  /**
+   * Check if we're already past the timeout.
+   * @return true if we're past the timeout, otherwise false. Also returns false if no timeout
+   * was specified
+   */
+  public boolean timedOut() {
+    if (!hasTimeout()) {
+      return false;
+    }
+    return timeout - stopwatch.elapsed(TimeUnit.MILLISECONDS) <= 0;
+  }
+
+  /**
+   * Get the number of milliseconds before the timeout is reached.
+   * <p>
+   * This method is used to pass down the remaining timeout to the RPCs, so has special semantics.
+   * A timeout of 0 is used to indicate an infinite timeout, and negative timeouts are invalid.
+   * Thus, if the timeout has passed (i.e. <tt>timeout - stopwatch.elapsedMillis() &lt;= 0</tt>),
+   * the returned value is floored at <tt>1</tt>.
+   * <p>
+   * Callers who care about this behavior should first check {@link #timedOut()}.
+   *
+   * @return the remaining millis before the timeout is reached, or 1 if the remaining time is
+   * lesser or equal to 0, or Long.MAX_VALUE if no timeout was specified (in which case it
+   * should never be called).
+   * @throws IllegalStateException if this method is called and no timeout was set
+   */
+  public long getMillisBeforeTimeout() {
+    if (!hasTimeout()) {
+      throw new IllegalStateException("This tracker doesn't have a timeout set so it cannot " +
+          "answer getMillisBeforeTimeout()");
+    }
+    long millisBeforeTimeout = timeout - stopwatch.elapsed(TimeUnit.MILLISECONDS);
+    millisBeforeTimeout = millisBeforeTimeout <= 0 ? 1 : millisBeforeTimeout;
+    return millisBeforeTimeout;
+  }
+
+  public long getElapsedMillis() {
+    return this.stopwatch.elapsed(TimeUnit.MILLISECONDS);
+  }
+
+  /**
+   * Tells if a non-zero timeout was set.
+   * @return true if the timeout is greater than 0, false otherwise.
+   */
+  public boolean hasTimeout() {
+    return timeout != 0;
+  }
+
+  /**
+   * Utility method to check if sleeping for a specified amount of time would put us past the
+   * timeout.
+   * @param plannedSleepTimeMillis number of milliseconds for a planned sleep
+   * @return if the planned sleeps goes past the timeout.
+   */
+  public boolean wouldSleepingTimeoutMillis(long plannedSleepTimeMillis) {
+    if (!hasTimeout()) {
+      return false;
+    }
+    return getMillisBeforeTimeout() - plannedSleepTimeMillis <= 0;
+  }
+
+  /**
+   * Sets the timeout to 0 (no timeout) and restarts the stopwatch from scratch.
+   */
+  public void reset() {
+    timeout = 0;
+    stopwatch.reset();
+    stopwatch.start();
+  }
+
+  /**
+   * Get the timeout (in milliseconds).
+   * @return the current timeout
+   */
+  public long getTimeout() {
+    return timeout;
+  }
+
+  /**
+   * Set a new timeout for this tracker. It cannot be smaller than 0,
+   * and if it is 0 then it means that there is no timeout (which is the default behavior).
+   * This method won't call reset().
+   * @param timeout a number of milliseconds greater or equal to 0
+   * @throws IllegalArgumentException if the timeout is lesser than 0
+   */
+  public void setTimeout(long timeout) {
+    if (timeout < 0) {
+      throw new IllegalArgumentException("The timeout must be greater or equal to 0, " +
+          "the passed value is " + timeout);
+    }
+    this.timeout = timeout;
+  }
+
+  @Override
+  public String toString() {
+    StringBuilder buf = new StringBuilder("TimeoutTracker(timeout=");
+    buf.append(timeout);
+    buf.append(", elapsed=").append(stopwatch.elapsed(TimeUnit.MILLISECONDS));
+    buf.append(")");
+    return buf.toString();
+  }
+}
diff --git a/java/kudu-client/src/test/java/org/apache/kudu/client/ITClient.java b/java/kudu-client/src/test/java/org/apache/kudu/client/ITClient.java
index e03ed4f..fa85efc 100644
--- a/java/kudu-client/src/test/java/org/apache/kudu/client/ITClient.java
+++ b/java/kudu-client/src/test/java/org/apache/kudu/client/ITClient.java
@@ -380,10 +380,10 @@ public class ITClient {
      */
     private boolean fullScan() {
       int rowCount;
-      DeadlineTracker deadlineTracker = new DeadlineTracker();
-      deadlineTracker.setDeadline(DEFAULT_SLEEP);
+      TimeoutTracker timeoutTracker = new TimeoutTracker();
+      timeoutTracker.setTimeout(DEFAULT_SLEEP);
 
-      while (keepRunningLatch.getCount() > 0 && !deadlineTracker.timedOut()) {
+      while (keepRunningLatch.getCount() > 0 && !timeoutTracker.timedOut()) {
         KuduScanner scanner = getScannerBuilder().build();
 
         try {
@@ -410,7 +410,7 @@ public class ITClient {
           // No need to do anything, we'll exit the loop once we test getCount() in the condition.
         }
       }
-      return !deadlineTracker.timedOut();
+      return !timeoutTracker.timedOut();
     }
 
     private KuduScanner.KuduScannerBuilder getScannerBuilder() {
diff --git a/java/kudu-client/src/test/java/org/apache/kudu/client/TestConnectionCache.java b/java/kudu-client/src/test/java/org/apache/kudu/client/TestConnectionCache.java
index 64b6ed2..8750d41 100644
--- a/java/kudu-client/src/test/java/org/apache/kudu/client/TestConnectionCache.java
+++ b/java/kudu-client/src/test/java/org/apache/kudu/client/TestConnectionCache.java
@@ -106,9 +106,9 @@ public class TestConnectionCache {
   }
 
   private void waitForConnectionToTerminate(Connection c) throws InterruptedException {
-    DeadlineTracker deadlineTracker = new DeadlineTracker();
-    deadlineTracker.setDeadline(5000);
-    while (!c.isTerminated() && !deadlineTracker.timedOut()) {
+    TimeoutTracker timeoutTracker = new TimeoutTracker();
+    timeoutTracker.setTimeout(5000);
+    while (!c.isTerminated() && !timeoutTracker.timedOut()) {
       Thread.sleep(250);
     }
   }
diff --git a/java/kudu-client/src/test/java/org/apache/kudu/client/TestDeadlineTracker.java b/java/kudu-client/src/test/java/org/apache/kudu/client/TestTimeoutTracker.java
similarity index 82%
rename from java/kudu-client/src/test/java/org/apache/kudu/client/TestDeadlineTracker.java
rename to java/kudu-client/src/test/java/org/apache/kudu/client/TestTimeoutTracker.java
index e5d8adf..b43c8d7 100644
--- a/java/kudu-client/src/test/java/org/apache/kudu/client/TestDeadlineTracker.java
+++ b/java/kudu-client/src/test/java/org/apache/kudu/client/TestTimeoutTracker.java
@@ -26,7 +26,7 @@ import com.google.common.base.Stopwatch;
 import com.google.common.base.Ticker;
 import org.junit.Test;
 
-public class TestDeadlineTracker {
+public class TestTimeoutTracker {
 
   @Test
   public void testTimeout() {
@@ -40,37 +40,37 @@ public class TestDeadlineTracker {
     Stopwatch stopwatch = Stopwatch.createUnstarted(ticker);
 
     // no timeout set
-    DeadlineTracker tracker = new DeadlineTracker(stopwatch);
-    tracker.setDeadline(0);
-    assertFalse(tracker.hasDeadline());
+    TimeoutTracker tracker = new TimeoutTracker(stopwatch);
+    tracker.setTimeout(0);
+    assertFalse(tracker.hasTimeout());
     assertFalse(tracker.timedOut());
 
     // 500ms timeout set
     tracker.reset();
-    tracker.setDeadline(500);
-    assertTrue(tracker.hasDeadline());
+    tracker.setTimeout(500);
+    assertTrue(tracker.hasTimeout());
     assertFalse(tracker.timedOut());
     assertFalse(tracker.wouldSleepingTimeoutMillis(499));
     assertTrue(tracker.wouldSleepingTimeoutMillis(500));
     assertTrue(tracker.wouldSleepingTimeoutMillis(501));
-    assertEquals(500, tracker.getMillisBeforeDeadline());
+    assertEquals(500, tracker.getMillisBeforeTimeout());
 
     // fast forward 200ms
     timeToReturn.set(200 * 1000000);
-    assertTrue(tracker.hasDeadline());
+    assertTrue(tracker.hasTimeout());
     assertFalse(tracker.timedOut());
     assertFalse(tracker.wouldSleepingTimeoutMillis(299));
     assertTrue(tracker.wouldSleepingTimeoutMillis(300));
     assertTrue(tracker.wouldSleepingTimeoutMillis(301));
-    assertEquals(300, tracker.getMillisBeforeDeadline());
+    assertEquals(300, tracker.getMillisBeforeTimeout());
 
     // fast forward another 400ms, so the RPC timed out
     timeToReturn.set(600 * 1000000);
-    assertTrue(tracker.hasDeadline());
+    assertTrue(tracker.hasTimeout());
     assertTrue(tracker.timedOut());
     assertTrue(tracker.wouldSleepingTimeoutMillis(299));
     assertTrue(tracker.wouldSleepingTimeoutMillis(300));
     assertTrue(tracker.wouldSleepingTimeoutMillis(301));
-    assertEquals(1, tracker.getMillisBeforeDeadline());
+    assertEquals(1, tracker.getMillisBeforeTimeout());
   }
 }
diff --git a/java/kudu-test-utils/src/main/java/org/apache/kudu/test/KuduTestHarness.java b/java/kudu-test-utils/src/main/java/org/apache/kudu/test/KuduTestHarness.java
index 10a1271..7b2834a 100644
--- a/java/kudu-test-utils/src/main/java/org/apache/kudu/test/KuduTestHarness.java
+++ b/java/kudu-test-utils/src/main/java/org/apache/kudu/test/KuduTestHarness.java
@@ -18,13 +18,13 @@ package org.apache.kudu.test;
 
 import org.apache.kudu.client.AsyncKuduClient;
 import org.apache.kudu.client.AsyncKuduClient.AsyncKuduClientBuilder;
-import org.apache.kudu.client.DeadlineTracker;
 import org.apache.kudu.client.HostAndPort;
 import org.apache.kudu.client.KuduClient;
 import org.apache.kudu.client.KuduException;
 import org.apache.kudu.client.KuduTable;
 import org.apache.kudu.client.LocatedTablet;
 import org.apache.kudu.client.RemoteTablet;
+import org.apache.kudu.client.TimeoutTracker;
 import org.apache.kudu.test.cluster.MiniKuduCluster;
 import org.apache.kudu.test.cluster.MiniKuduCluster.MiniKuduClusterBuilder;
 import org.apache.kudu.test.cluster.FakeDNS;
@@ -42,7 +42,6 @@ import java.lang.annotation.ElementType;
 import java.lang.annotation.Retention;
 import java.lang.annotation.RetentionPolicy;
 import java.lang.annotation.Target;
-import java.util.Arrays;
 import java.util.List;
 import java.util.Random;
 
@@ -231,17 +230,17 @@ public class KuduTestHarness extends ExternalResource {
   public HostAndPort findLeaderTabletServer(LocatedTablet tablet)
       throws Exception {
     LocatedTablet.Replica leader = null;
-    DeadlineTracker deadlineTracker = new DeadlineTracker();
-    deadlineTracker.setDeadline(DEFAULT_SLEEP);
+    TimeoutTracker timeoutTracker = new TimeoutTracker();
+    timeoutTracker.setTimeout(DEFAULT_SLEEP);
     while (leader == null) {
-      if (deadlineTracker.timedOut()) {
+      if (timeoutTracker.timedOut()) {
         fail("Timed out while trying to find a leader for this table");
       }
 
       leader = tablet.getLeaderReplica();
       if (leader == null) {
         LOG.info("Sleeping while waiting for a tablet LEADER to arise, currently slept {} ms",
-            deadlineTracker.getElapsedMillis());
+            timeoutTracker.getElapsedMillis());
         Thread.sleep(50);
       }
     }
diff --git a/java/kudu-test-utils/src/test/java/org/apache/kudu/test/TestMiniKuduCluster.java b/java/kudu-test-utils/src/test/java/org/apache/kudu/test/TestMiniKuduCluster.java
index 1722a57..68b3933 100644
--- a/java/kudu-test-utils/src/test/java/org/apache/kudu/test/TestMiniKuduCluster.java
+++ b/java/kudu-test-utils/src/test/java/org/apache/kudu/test/TestMiniKuduCluster.java
@@ -22,11 +22,11 @@ import static org.junit.Assert.fail;
 import java.io.IOException;
 import java.net.Socket;
 
-import org.apache.kudu.client.DeadlineTracker;
 import org.apache.kudu.client.HostAndPort;
 import org.apache.kudu.client.KuduClient;
 import org.apache.kudu.client.KuduClient.KuduClientBuilder;
 import org.apache.kudu.client.ListTablesResponse;
+import org.apache.kudu.client.TimeoutTracker;
 import org.apache.kudu.test.cluster.MiniKuduCluster;
 import org.apache.kudu.test.junit.RetryRule;
 import org.apache.kudu.test.cluster.FakeDNS;
@@ -116,7 +116,7 @@ public class TestMiniKuduCluster {
    */
   private static void testHostPort(HostAndPort hp,
                                    boolean testIsOpen) throws InterruptedException {
-    DeadlineTracker tracker = new DeadlineTracker();
+    TimeoutTracker tracker = new TimeoutTracker();
     while (tracker.getElapsedMillis() < SLEEP_TIME_MS) {
       try {
         Socket socket = new Socket(hp.getHost(), hp.getPort());