public void run() throws SerializationException, SQLException {
  final String query=String.format("INSERT INTO %s (" + "audit_log_id, " + "stage, "+ "mappers, "+ "reducers, "+ "cpu_time, "+ "counters) "+ "VALUES (?, ?, ?, ?, ?, ?)",tableName);
  Map<String,MapRedStats> statsPerStage=sessionStateLite.getMapRedStats();
  for (  String stage : statsPerStage.keySet()) {
    MapRedStats stats=statsPerStage.get(stage);
    PreparedStatement ps=connection.prepareStatement(query);
    int psIndex=1;
    ps.setLong(psIndex++,auditLogId);
    ps.setString(psIndex++,stage);
    ps.setLong(psIndex++,stats.getNumMap());
    ps.setLong(psIndex++,stats.getNumReduce());
    ps.setLong(psIndex++,stats.getCpuMSec());
    ps.setString(psIndex,toJson(stats.getCounters()));
    ps.executeUpdate();
  }
}

public void run ( ) throws SerializationException , SQLException { final String query = String . format ( "INSERT INTO %s (" + "audit_log_id, " + "stage, " + "mappers, " + "reducers, " + "cpu_time, " + "counters) " + "VALUES (?, ?, ?, ?, ?, ?)" , tableName ) ; Map < String , MapRedStats > statsPerStage = sessionStateLite . getMapRedStats ( ) ; for ( String stage : statsPerStage . keySet ( ) ) { MapRedStats stats = statsPerStage . get ( stage ) ; PreparedStatement ps = connection . prepareStatement ( query ) ; int psIndex = 1 ; ps . setLong ( psIndex ++ , auditLogId ) ; ps . setString ( psIndex ++ , stage ) ; ps . setLong ( psIndex ++ , stats . getNumMap ( ) ) ; ps . setLong ( psIndex ++ , stats . getNumReduce ( ) ) ; ps . setLong ( psIndex ++ , stats . getCpuMSec ( ) ) ; ps . setString ( psIndex , toJson ( stats . getCounters ( ) ) ) ; ps . executeUpdate ( ) ; } }
runs the log module , writing the relevant audit data to the db .
