[ 
https://issues.apache.org/jira/browse/HBASE-12785?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14265183#comment-14265183
 ] 

Sean Busbey commented on HBASE-12785:
-------------------------------------

+1, minor issue:

{code}
+    final int timeoutInSeconds = 30;
+      stream = futureTask.get(30, TimeUnit.SECONDS);
+    } catch (ExecutionException ee) {
+      LOG.warn("Encountered exception when opening lock file", ee);
+    } catch (InterruptedException ie) {
+      LOG.warn("Interrupted when opening lock file", ie);
+      Thread.currentThread().interrupt();
+    } catch (TimeoutException exception) {
+      // took too long to obtain lock
+      LOG.warn("Took more than " + timeoutInSeconds + " seconds in obtaining 
lock");
+      futureTask.cancel(true);
{code}

Either make futureTask.get use the timeoutInSeconds variable or skip it 
entirely and hard-code "30" in the error message.

> Use FutureTask to timeout the attempt to get the lock for hbck
> --------------------------------------------------------------
>
>                 Key: HBASE-12785
>                 URL: https://issues.apache.org/jira/browse/HBASE-12785
>             Project: HBase
>          Issue Type: Task
>            Reporter: Ted Yu
>            Assignee: Ted Yu
>            Priority: Minor
>         Attachments: 12785-001.patch, 12785-002.patch
>
>
> In reviewing HBASE-12607, Sean pointed out:
> It would be nice if we used a 
> [FutureTask|http://docs.oracle.com/javase/7/docs/api/java/util/concurrent/FutureTask.html]
>  to timeout the attempt to get the lock rather than wait the whole period and 
> then fail.
> This issue is to address Sean's review comment.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to