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

Hiroshi Ikeda commented on HBASE-15292:
---------------------------------------

{quote}
Add javadoc and audience annotation to the class.
{quote}
Audience annotations are for public classes, as their documentation. Non-public 
classes cannot be API and cannot break compatibility.
Javadoc might be useful so I'll try next week :)

{quote}
Call to Thread.currentThread().interrupt() can be performed inside the catch 
block - this would save variable interrupted.
{quote}
That is required to postpone the interruption at pendingLatch.await() inside 
the catch block, otherwise that method doesn't wait.

{quote}
One way of calming findbugs is to use (instanceHolder != null) as condition for 
the while loop.
{quote}
I'll try it :)

{quote}
Actually can PendingWatcher be omitted ?
InstancePending is generic and the two methods PendingWatcher overrides are 
one-liner.
{quote}
The thread safety of InstancePending is based on a subtle part of the Java 
Language Specification, in order to avoid slight overhead of synchronization. 
That is tricky and will be easily broken when someone edits, and it is better 
to encapsulate the concern into an independent class.

{quote}
After the change, "hbase.zookeeper.watcher.sync.connected.wait" is dropped.
Should the loop in InstancePending#get() be passed a timeout so that the above 
config is still respected ?
{quote}
No. PendingWathcer.prepare is expected to call immediately after its 
instantiation.
Moreover, the name of the property is wrong in actual fact; The existing code 
sleeps until just sharing the data without synchronization (and to make matters 
worse, sophisticated VM implementations might optimize and replace the variable 
references to null forever).


> Refined ZooKeeperWatcher to prevent ZooKeeper's callback while construction
> ---------------------------------------------------------------------------
>
>                 Key: HBASE-15292
>                 URL: https://issues.apache.org/jira/browse/HBASE-15292
>             Project: HBase
>          Issue Type: Bug
>          Components: Zookeeper
>            Reporter: Hiroshi Ikeda
>            Assignee: Hiroshi Ikeda
>            Priority: Minor
>         Attachments: HBASE-15292-V2.patch, HBASE-15292-V3.patch, 
> HBASE-15292-V4.patch, HBASE-15292.patch
>
>
> The existing code is not just messy but also contains a subtle bug of 
> visibility due to missing synchronization between threads.
> The root of the evil is that ZooKeeper uses a silly anti-pattern, starting a 
> thread within its constructor, and in practice all the developers are not 
> allowed to use ZooKeeper correctly without tedious code.



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

Reply via email to