Source:
public void insertMetrics(Collection<IMetric> metrics, Granularity granularity) throws IOException { Timer.Context ctx = Instrumentation.getWriteTimerContext( CassandraModel.getPreaggregatedColumnFamilyName(granularity)); try { Map<ResultSetFuture, Locator> futureLocatorMap = new HashMap<ResultSetFuture, Locator>(); Multimap<Locator, IMetric> map = asMultimap(metrics); for (Locator locator : map.keySet()) { for (IMetric metric : map.get(locator)) { RollupType rollupType = metric.getRollupType(); DAbstractMetricIO io = rollupTypeToIO.get(rollupType); if ( io == null ) { throw new InvalidDataException( String.format("insertMetrics(locator=%s, granularity=%s): unsupported preaggregated rollupType=%s", locator, granularity, rollupType.name())); } if (!(metric.getMetricValue() instanceof Rollup)) { throw new InvalidDataException( String.format("insertMetrics(locator=%s, granularity=%s): metric value %s is not type Rollup", locator, granularity, metric.getMetricValue().getClass().getSimpleName()) ); } ResultSetFuture future = io.putAsync(locator, metric.getCollectionTime(), (Rollup) metric.getMetricValue(), granularity, metric.getTtlInSeconds()); futureLocatorMap.put(future, locator); if ( !isLocatorCurrent(locator) ) { locatorIO.insertLocator(locator); setLocatorCurrent(locator); } else { LOG.debug("insertMetrics(): not inserting locator " + locator); } } } for (ResultSetFuture future : futureLocatorMap.keySet()) { try { future.getUninterruptibly().all(); Instrumentation.markFullResPreaggregatedMetricWritten(); } catch (Exception ex) { Instrumentation.markWriteError(); LOG.error(String.format("error writing preaggregated metric for locator %s, granularity %s", futureLocatorMap.get(future), granularity), ex); } } } finally { ctx.stop(); } }

Target:
public void insertMetrics(Collection<IMetric> metrics, Granularity granularity) throws IOException { Timer.Context ctx = Instrumentation.getWriteTimerContext( CassandraModel.getPreaggregatedColumnFamilyName(granularity)); try { Map<ResultSetFuture, Locator> futureLocatorMap = new HashMap<ResultSetFuture, Locator>(); Multimap<Locator, IMetric> map = asMultimap(metrics); for (Locator locator : map.keySet()) { for (IMetric metric : map.get(locator)) { RollupType rollupType = metric.getRollupType(); DAbstractMetricIO io = rollupTypeToIO.get(rollupType); if ( io == null ) { throw new InvalidDataException( String.format("insertMetrics(locator=%s, granularity=%s): unsupported preaggregated rollupType=%s", locator, granularity, rollupType.name())); } if (!(metric.getMetricValue() instanceof Rollup)) { throw new InvalidDataException( String.format("insertMetrics(locator=%s, granularity=%s): metric value %s is not type Rollup", locator, granularity, metric.getMetricValue().getClass().getSimpleName()) ); } ResultSetFuture future = io.putAsync(locator, metric.getCollectionTime(), (Rollup) metric.getMetricValue(), granularity, metric.getTtlInSeconds()); futureLocatorMap.put(future, locator); if ( !isLocatorCurrent(locator) ) { locatorIO.insertLocator(locator); setLocatorCurrent(locator); } else { LOG.debug("insertMetrics(): not inserting locator " + locator); } } } for (ResultSetFuture future : futureLocatorMap.keySet()) { try { future.getUninterruptibly().all(); if (granularity == Granularity.FULL) { Instrumentation.markFullResPreaggregatedMetricWritten(); } } catch (Exception ex) { Instrumentation.markWriteError(); LOG.error(String.format("error writing preaggregated metric for locator %s, granularity %s", futureLocatorMap.get(future), granularity), ex); } } } finally { ctx.stop(); } }