/** Get the Transport Metric for a specific Transport Type */ public TransportMetric getTransportMetric(String protocol, EndpointAddress endpointAddress) { for (Iterator i = transportMetrics.iterator(); i.hasNext(); ) { TransportMetric transportMetric = (TransportMetric) i.next(); if (protocol.equals(transportMetric.getProtocol()) && endpointAddress.equals(transportMetric.getEndpointAddress())) return transportMetric; } return null; }
/** * 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; }
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); } } }
/** * Get the Transport Metric for a specific Transport Type * * @param prototype a similar Transport metric object (ie same protocol/endpointAddress) * @see getTransportMetric(String, EndpointAddress) */ public TransportMetric getTransportMetric(TransportMetric prototype) { return getTransportMetric(prototype.getProtocol(), prototype.getEndpointAddress()); }