Uploaded image for project: 'Hadoop Common'
  1. Hadoop Common
  2. HADOOP-3470

Bad coding style: The member fields in org.apache.hadoop.ipc.metrics.RpcMetrics are public

    Details

    • Type: Improvement
    • Status: Resolved
    • Priority: Major
    • Resolution: Won't Fix
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: metrics
    • Labels:
      None

      Description

      In org.apache.hadoop.ipc.metrics.RpcMetrics,

      //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>());
      

      Then, the fields are accessed directly in other classes. For example, org.apache.hadoop.ipc.RPC.Server.call(...)

      ...
      	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);
      	}
      

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                szetszwo Tsz Wo Nicholas Sze
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: