[
https://issues.apache.org/jira/browse/HBASE-19312?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16260271#comment-16260271
]
Duo Zhang commented on HBASE-19312:
-----------------------------------
[~mdrob] hey curator committer, could you please explain this line?
https://github.com/apache/curator/blob/6d36a4793b31cdacaf4bbf6554e05d68bc680001/curator-framework/src/main/java/org/apache/curator/framework/imps/CuratorFrameworkImpl.java#L943
{code}
if ( !operationAndData.isConnectionRequired() ||
client.isConnected() )
{
operationAndData.callPerformBackgroundOperation();
}
else
{
client.getZooKeeper(); // important - allow connection resets,
timeouts, etc. to occur
if ( operationAndData.getElapsedTimeMs() >=
client.getConnectionTimeoutMs() )
{
throw new CuratorConnectionLossException();
}
operationAndData.sleepFor(1, TimeUnit.SECONDS); // <===== here
queueOperation(operationAndData);
}
{code}
Why there is a sleep if the client is not connected yet? In fact I do not want
to block the client thread so I do not call blockUntilConnected and use the
asynchronous API of CuratorFramework(inBackground) to get data. But sadly if
the connection to zk is not established yet we will sleep 1 second here...
Is this intentional? If yes, then what is the correct way to write fully
asynchronous code with curator? Thanks.
> Find out why sometimes we need to spend more than one second to get the
> cluster id
> ----------------------------------------------------------------------------------
>
> Key: HBASE-19312
> URL: https://issues.apache.org/jira/browse/HBASE-19312
> Project: HBase
> Issue Type: Bug
> Reporter: Duo Zhang
>
> See the discussion in HBASE-19266.
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)