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 Improvement
    • Status: Open
    • Priority: Major Major
    • Resolution: Unresolved
    • 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);
      	}
      

        Issue Links

          Activity

          Tsz Wo Nicholas Sze made changes -
          Link This issue is related to HADOOP-5714 [ HADOOP-5714 ]
          Tsz Wo Nicholas Sze made changes -
          Field Original Value New Value
          Link This issue incorporates HADOOP-4838 [ HADOOP-4838 ]
          Tsz Wo Nicholas Sze created issue -

            People

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

              Dates

              • Created:
                Updated:

                Development