コード例 #1
0
  /**
   * Make a deep copy of this metric only including the portions designated in the Filter The
   * resulting metric is Safe to modify without danger to the underlying Monitor Metrics
   *
   * @param rendezvousServiceMonitorFilter Filter designates constituant parts to be included
   * @return a copy of this metric with references to the designated parts
   */
  public TransportServiceMetric deepCopy(
      TransportServiceMonitorFilter transportServiceMonitorFilter) {
    TransportServiceMetric serviceMetric = new TransportServiceMetric();
    serviceMetric.moduleClassID = moduleClassID;

    serviceMetric.mergeMetrics(this, transportServiceMonitorFilter);
    return serviceMetric;
  }
コード例 #2
0
  /**
   * Make a shallow copy of this metric only including the portions designated in the Filter
   *
   * <p>Note: since this is a shallow copy it is dangerous to modify the submetrics
   *
   * @param transportServiceMonitorFilter Filter designates constituant parts to be included
   * @return a copy of this metric with references to the designated parts
   */
  public TransportServiceMetric shallowCopy(
      TransportServiceMonitorFilter transportServiceMonitorFilter) {
    TransportServiceMetric serviceMetric = new TransportServiceMetric();
    serviceMetric.moduleClassID = moduleClassID;

    for (Iterator i = getTransportMetrics(); i.hasNext(); ) {
      TransportMetric transportMetric = (TransportMetric) i.next();
      String protocol = transportMetric.getProtocol();

      if (transportServiceMonitorFilter.hasTransport(protocol))
        serviceMetric.addTransportMetric(transportMetric);
    }

    return serviceMetric;
  }