Ejemplo n.º 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;
  }
Ejemplo n.º 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;
  }
Ejemplo n.º 3
0
  public void mergeMetrics(
      ServiceMetric serviceMetric, TransportServiceMonitorFilter transportServiceMonitorFilter) {
    TransportServiceMetric otherTransportServiceMetric = (TransportServiceMetric) serviceMetric;

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

      if ((transportServiceMonitorFilter == null)
          || transportServiceMonitorFilter.hasTransport(protocol)) {
        TransportMetric transportMetric =
            getTransportMetric(
                otherTransportMetric.getProtocol(), otherTransportMetric.getEndpointAddress());

        if (transportMetric == null) {
          transportMetric = new TransportMetric(otherTransportMetric);
          addTransportMetric(transportMetric);
        }

        transportMetric.mergeMetrics(otherTransportMetric);
      }
    }
  }