com.continuent.tungsten.replicator.heartbeat
Class HeartbeatTable

java.lang.Object
  extended by com.continuent.tungsten.replicator.heartbeat.HeartbeatTable

public class HeartbeatTable
extends java.lang.Object

Provides a definition for a heartbeat table, which measures latency between master and slave. The heartbeat table is created with a single row that is then update to track changes. This class provides methods to update the table.

Version:
1.0
Author:
Robert Hodges

Field Summary
static java.lang.String TABLE_NAME
           
 
Constructor Summary
HeartbeatTable(java.lang.String schema, java.lang.String tableType)
           
HeartbeatTable(java.lang.String schema, java.lang.String tableType, java.lang.String serviceName)
           
 
Method Summary
 void applyHeartbeat(Database database, java.sql.Timestamp sourceTimestamp, java.lang.String name)
          Applies a heartbeat update on the slave.
 void completeHeartbeat(Database database, long seqno, java.lang.String eventId)
          Execute this call to fill in heartbeat data on the slave.
 Table getTable()
          Returns metadata used to create the underlying heartbeat table.
 void initializeHeartbeatTable(Database database)
          Set up the heartbeat table on the master.
 void startHeartbeat(Database database, java.lang.String name)
          Execute this call to start a named heartbeat on the master.
 void startHeartbeat(java.lang.String url, java.lang.String user, java.lang.String password, java.lang.String name)
          Wrapper for startHeartbeat() call.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TABLE_NAME

public static final java.lang.String TABLE_NAME
See Also:
Constant Field Values
Constructor Detail

HeartbeatTable

public HeartbeatTable(java.lang.String schema,
                      java.lang.String tableType)

HeartbeatTable

public HeartbeatTable(java.lang.String schema,
                      java.lang.String tableType,
                      java.lang.String serviceName)
Method Detail

getTable

public Table getTable()
Returns metadata used to create the underlying heartbeat table.


initializeHeartbeatTable

public void initializeHeartbeatTable(Database database)
                              throws java.sql.SQLException
Set up the heartbeat table on the master.

Throws:
java.sql.SQLException

startHeartbeat

public void startHeartbeat(Database database,
                           java.lang.String name)
                    throws java.sql.SQLException
Execute this call to start a named heartbeat on the master. The heartbeat table update must be logged as we will expect to see it as a DBMSEvent.

Throws:
java.sql.SQLException

startHeartbeat

public void startHeartbeat(java.lang.String url,
                           java.lang.String user,
                           java.lang.String password,
                           java.lang.String name)
                    throws java.sql.SQLException
Wrapper for startHeartbeat() call.

Throws:
java.sql.SQLException

completeHeartbeat

public void completeHeartbeat(Database database,
                              long seqno,
                              java.lang.String eventId)
                       throws java.sql.SQLException
Execute this call to fill in heartbeat data on the slave. This call must be invoked after a heartbeat event is applied.

Throws:
java.sql.SQLException

applyHeartbeat

public void applyHeartbeat(Database database,
                           java.sql.Timestamp sourceTimestamp,
                           java.lang.String name)
                    throws java.sql.SQLException
Applies a heartbeat update on the slave. This call is designed for data warehouses that cannot apply a heartbeat using batch loading mechanisms.

Throws:
java.sql.SQLException