Created
October 14, 2011 19:11
-
-
Save shrijeet/1288023 to your computer and use it in GitHub Desktop.
RPC timeout issue
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/src/main/java/org/apache/hadoop/hbase/ipc/HBaseClient.java b/src/main/java/org/apache/hadoop/hbase/ipc/HBaseClient.java | |
index 2cc1b04..c08a55e 100644 | |
--- a/src/main/java/org/apache/hadoop/hbase/ipc/HBaseClient.java | |
+++ b/src/main/java/org/apache/hadoop/hbase/ipc/HBaseClient.java | |
@@ -209,6 +209,7 @@ public class HBaseClient { | |
* socket connected to a remote address. Calls are multiplexed through this | |
* socket: responses may be delivered out of order. */ | |
private class Connection extends Thread { | |
+ protected static final long DEFAULT_CLEAN_INTERVAL = -1; // disabled by default | |
private ConnectionId remoteId; | |
private Socket socket = null; // connected socket | |
private DataInputStream in; | |
@@ -236,6 +237,29 @@ public class HBaseClient { | |
remoteId.getAddress().toString() + | |
((ticket==null)?" from an unknown user": (" from " + ticket.getUserName()))); | |
this.setDaemon(true); | |
+ final long rpcto = remoteId.rpcTimeout; | |
+ final long cleaning_interval = conf.getLong("hbase.client.calls.clean.interval", | |
+ DEFAULT_CLEAN_INTERVAL); | |
+ if (cleaning_interval > 0) { | |
+ Thread cleaner = new Thread(new Runnable() { | |
+ @Override | |
+ public void run() { | |
+ while (true) { | |
+ long now = System.currentTimeMillis(); | |
+ cleanupCalls(rpcto); | |
+ long wakeup = now + cleaning_interval; | |
+ while (System.currentTimeMillis() < wakeup) { | |
+ try { | |
+ Thread.sleep(cleaning_interval); | |
+ } catch (InterruptedException e) { | |
+ } | |
+ } | |
+ } | |
+ } | |
+ }, "Cleaner"); | |
+ cleaner.setDaemon(true); | |
+ cleaner.start(); | |
+ } | |
} | |
/** Update lastActivity with the current time. */ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment