[
https://issues.apache.org/jira/browse/HADOOP-3470?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12656202#action_12656202
]
Tsz Wo (Nicholas), SZE commented on HADOOP-3470:
------------------------------------------------
How about making all these fields final?
> Bad coding style: The member fields in
> org.apache.hadoop.ipc.metrics.RpcMetrics are public
> ------------------------------------------------------------------------------------------
>
> Key: HADOOP-3470
> URL: https://issues.apache.org/jira/browse/HADOOP-3470
> Project: Hadoop Core
> Issue Type: Improvement
> Components: metrics
> Reporter: Tsz Wo (Nicholas), SZE
>
> In org.apache.hadoop.ipc.metrics.RpcMetrics,
> {code}
> //the following are member fields
> public MetricsTimeVaryingRate rpcQueueTime = new
> MetricsTimeVaryingRate("RpcQueueTime");
> public MetricsTimeVaryingRate rpcProcessingTime = new
> MetricsTimeVaryingRate("RpcProcessingTime");
> public Map <String, MetricsTimeVaryingRate> metricsList =
> Collections.synchronizedMap(new HashMap<String, MetricsTimeVaryingRate>());
> {code}
> Then, the fields are accessed directly in other classes. For example,
> org.apache.hadoop.ipc.RPC.Server.call(...)
> {code}
> ...
> MetricsTimeVaryingRate m =
> rpcMetrics.metricsList.get(call.getMethodName());
> if (m != null) {
> m.inc(processingTime);
> }
> else {
> rpcMetrics.metricsList.put(call.getMethodName(), new
> MetricsTimeVaryingRate(call.getMethodName()));
> m = rpcMetrics.metricsList.get(call.getMethodName());
> m.inc(processingTime);
> }
> {code}
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.