public void completeHeartbeat(Database database,long seqno,String eventId) throws SQLException {
  if (logger.isDebugEnabled())   logger.debug("Processing slave heartbeat update");
  Statement st=null;
  ResultSet rs=null;
  Timestamp sts=new Timestamp(0);
  Timestamp now=new Timestamp(System.currentTimeMillis());
  ArrayList<Column> whereClause=new ArrayList<Column>();
  ArrayList<Column> values=new ArrayList<Column>();
  if (logger.isDebugEnabled())   logger.debug("Processing slave heartbeat update: " + now);
  try {
    st=database.createStatement();
    rs=st.executeQuery(sourceTsQuery);
    if (rs.next())     sts=rs.getTimestamp(1);
  }
  finally {
    if (rs != null) {
      try {
        rs.close();
      }
 catch (      SQLException e) {
      }
    }
    if (st != null) {
      try {
        st.close();
      }
 catch (      SQLException e) {
      }
    }
  }
  long lag_millis=now.getTime() - sts.getTime();
  hbId.setValue(KEY);
  whereClause.add(hbId);
  hbSeqno.setValue(seqno);
  hbEventId.setValue(eventId);
  hbTargetTstamp.setValue(now);
  hbLagMillis.setValue(lag_millis);
  values.add(hbSeqno);
  values.add(hbEventId);
  values.add(hbTargetTstamp);
  values.add(hbLagMillis);
  database.update(hbTable,whereClause,values);
}

public void completeHeartbeat ( Database database , long seqno , String eventId ) throws SQLException { if ( logger . isDebugEnabled ( ) ) logger . debug ( "Processing slave heartbeat update" ) ; Statement st = null ; ResultSet rs = null ; Timestamp sts = new Timestamp ( 0 ) ; Timestamp now = new Timestamp ( System . currentTimeMillis ( ) ) ; ArrayList < Column > whereClause = new ArrayList < Column > ( ) ; ArrayList < Column > values = new ArrayList < Column > ( ) ; if ( logger . isDebugEnabled ( ) ) logger . debug ( "Processing slave heartbeat update: " + now ) ; try { st = database . createStatement ( ) ; rs = st . executeQuery ( sourceTsQuery ) ; if ( rs . next ( ) ) sts = rs . getTimestamp ( 1 ) ; } finally { if ( rs != null ) { try { rs . close ( ) ; } catch ( SQLException e ) { } } if ( st != null ) { try { st . close ( ) ; } catch ( SQLException e ) { } } } long lag_millis = now . getTime ( ) - sts . getTime ( ) ; hbId . setValue ( KEY ) ; whereClause . add ( hbId ) ; hbSeqno . setValue ( seqno ) ; hbEventId . setValue ( eventId ) ; hbTargetTstamp . setValue ( now ) ; hbLagMillis . setValue ( lag_millis ) ; values . add ( hbSeqno ) ; values . add ( hbEventId ) ; values . add ( hbTargetTstamp ) ; values . add ( hbLagMillis ) ; database . update ( hbTable , whereClause , values ) ; }
execute this call to fill in heartbeat data on the slave . this call must be invoked after a heartbeat event is applied .
