[ 
https://issues.apache.org/jira/browse/HDFS-524?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12739266#action_12739266
 ] 

Konstantin Boudnik commented on HDFS-524:
-----------------------------------------

- {{final}} along with {{private}} seems to be a redundant declaration, 'cause 
{{private}} modifier assumes that won't be overridden.
- would it make sense to have a separate metric update method to replace nearly 
identical code like
{noformat}
+    datanode.myMetrics.writeBlockOp.inc(DataNode.now() - opStartTime);
+    final boolean local = s.getInetAddress().equals(s.getLocalAddress());
+    if (local)
+      datanode.myMetrics.writesFromLocalClient.inc();
+    else
+      datanode.myMetrics.writesFromRemoteClient.inc();
{noformat}
which would handle and wrap the update logic? Perhaps 
{{updateDNMetrics(MetricsBase metricType)}} or similar?
- also, 
{noformat}
+    final boolean local = s.getInetAddress().equals(s.getLocalAddress());
{noformat} 
might be converted to the class level constant to avoid an extra initialization 
on each call of {{opWriteBlock}} and {{opReadBlock}}

I know that only public methods should have JavaDoc, but wouldn't it be good to 
have them for protected ones as well? :-)

> Further DataTransferProtocol code refactoring.
> ----------------------------------------------
>
>                 Key: HDFS-524
>                 URL: https://issues.apache.org/jira/browse/HDFS-524
>             Project: Hadoop HDFS
>          Issue Type: Improvement
>          Components: data-node
>    Affects Versions: 0.21.0
>            Reporter: Tsz Wo (Nicholas), SZE
>            Assignee: Tsz Wo (Nicholas), SZE
>             Fix For: 0.21.0
>
>         Attachments: h524_20090803.patch, h524_20090804.patch
>
>
> This is a further refactoring over HDFS-377 to move generic codes from 
> DataXceiver to DataTransferProtocol.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to