blueflood-core/src/main/java/com/rackspacecloud/blueflood/io/datastax/DAbstractMetricsRW.java
@Override
    public void insertRollups(List<SingleRollupWriteContext> writeContexts) {

        if (writeContexts.size() == 0) {
            return;
        }

        Timer.Context ctx = Instrumentation.getWriteTimerContext( writeContexts.get( 0 ).getDestinationCF().getName() );
        try {

            BatchStatement batch = new BatchStatement(BatchStatement.Type.UNLOGGED);

            for (SingleRollupWriteContext writeContext : writeContexts) {
                Rollup rollup = writeContext.getRollup();
                Locator locator = writeContext.getLocator();
                Granularity granularity = writeContext.getGranularity();
                int ttl = getTtl(locator, rollup.getRollupType(), granularity);

                // lookup the right writer
                RollupType rollupType = writeContext.getRollup().getRollupType();
                DAbstractMetricIO io = getIO(rollupType.name().toLowerCase(), granularity);

                Statement statement = io.createStatement(locator, writeContext.getTimestamp(), rollup, writeContext.getGranularity(), ttl);
                batch.add(statement);
            }

            Session session = DatastaxIO.getSession();
            session.execute(batch);

        } catch (Exception ex) {
            Instrumentation.markWriteError();
            LOG.error(String.format("error writing locator batch of size %s, granularity %s", writeContexts.size(), writeContexts.get(0).getGranularity()), ex);
        } finally {
            ctx.stop();
        }
    }
@Override
    public void insertRollups(List<SingleRollupWriteContext> writeContexts) {

        if (writeContexts.size() == 0) {
            return;
        }

        Timer.Context ctx = Instrumentation.getWriteTimerContext( writeContexts.get( 0 ).getDestinationCF().getName() );
        try {

            BatchStatement batch = new BatchStatement(BatchStatement.Type.UNLOGGED);

            for (SingleRollupWriteContext writeContext : writeContexts) {
                Rollup rollup = writeContext.getRollup();
                Locator locator = writeContext.getLocator();
                Granularity granularity = writeContext.getGranularity();
                int ttl = getTtl(locator, rollup.getRollupType(), granularity);

                // lookup the right writer
                RollupType rollupType = writeContext.getRollup().getRollupType();
                DAbstractMetricIO io = getIO(rollupType.name().toLowerCase(), granularity);

                Statement statement = io.createStatement(locator, writeContext.getTimestamp(), rollup, writeContext.getGranularity(), ttl);
                batch.add(statement);
            }

            Session session = DatastaxIO.getSession();
            session.execute(batch);

        } catch (Exception ex) {
            Instrumentation.markWriteError();
            LOG.error(String.format("error writing locator batch of size %s, granularity %s", writeContexts.size(), writeContexts.get(0).getGranularity()), ex);
        } finally {
            ctx.stop();
        }
    }
@ Override public void insertRollups ( List < SingleRollupWriteContext > writeContexts ) { if ( writeContexts . size ( ) == 0 ) { return ; } Timer . Context ctx = Instrumentation . getWriteTimerContext ( writeContexts . get ( 0 ) . getDestinationCF ( ) . getName ( ) ) ; try { BatchStatement batch = new BatchStatement ( BatchStatement . Type . UNLOGGED ) ; for ( SingleRollupWriteContext writeContext : writeContexts ) { Rollup rollup = writeContext . getRollup ( ) ; Locator locator = writeContext . getLocator ( ) ; Granularity granularity = writeContext . getGranularity ( ) ; int ttl = getTtl ( locator , rollup . getRollupType ( ) , granularity ) ; // lookup the right writer RollupType rollupType = writeContext . getRollup ( ) . getRollupType ( ) ; DAbstractMetricIO io = getIO ( rollupType . name ( ) . toLowerCase ( ) , granularity ) ; Statement statement = io . createStatement ( locator , writeContext . getTimestamp ( ) , rollup , writeContext . getGranularity ( ) , ttl ) ; batch . add ( statement ) ; } Session session = DatastaxIO . getSession ( ) ; session . execute ( batch ) ; } catch ( Exception ex ) { Instrumentation . markWriteError ( ) ; LOG . error ( String . format ( "error writing locator batch of size %s, granularity %s" , writeContexts . size ( ) , writeContexts . get ( 0 ) . getGranularity ( ) ) , ex ) ; } finally { ctx . stop ( ) ; } }
This method inserts a collection of {@link com.rackspacecloud.blueflood.service.SingleRollupWriteContext} objects
to the appropriate Cassandra column family.

It performs the inserts by executing an UNLOGGED BATCH statement.

@param writeContexts

@throws IOException
This method inserts a collection of { @link com . rackspacecloud . blueflood . service . SingleRollupWriteContext } objects to the appropriate Cassandra column family .