Class BackupData

java.lang.Object
com.bank.trading.data.BackupData
All Implemented Interfaces:
Runnable

public class BackupData extends Object implements Runnable
Backup data service that receives log data form the Lamport clock service and then backs it up in SQL database. Also retrieves the backup data from the long term storage.
  • Constructor Summary

    Constructors
    Constructor
    Description
    BackupData(URI storage, InetSocketAddress address, InetSocketAddress LamportAddress)
    Constructor to initialize the backup data service.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    backupData(byte[] logs)
    Backup log data to long term database storage.
    byte[]
    getBackupData(Long startTime, Long endTime)
    Retrieve backup data from long term storage.
    void
    run()
    Run the backup data service keep connection open to receive data and send to long term storage Message includes method calling and parameters Also accept incoming requests to retrieve backup data.
    void
    setStorageAddress(URI storageAddress)
    Set the address of the SQL Database.

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • BackupData

      public BackupData(URI storage, InetSocketAddress address, InetSocketAddress LamportAddress)
      Constructor to initialize the backup data service.
      Parameters:
      storage - the URI of the long term storage database.
      address - the address of the backup data service.
      LamportAddress - the address of the Lamport clock service.
  • Method Details

    • setStorageAddress

      public void setStorageAddress(URI storageAddress)
      Set the address of the SQL Database.
      Parameters:
      storageAddress - the URI of the long term storage database.
    • backupData

      public void backupData(byte[] logs)
      Backup log data to long term database storage. Convert from event logs to SQL format Send the data to the database at storageAddress.
      Parameters:
      logs - the byte array of the event logs to back up.
    • getBackupData

      public byte[] getBackupData(Long startTime, Long endTime)
      Retrieve backup data from long term storage.
      Parameters:
      startTime - the start time of the data to retrieve.
      endTime - the end time of the data to retrieve.
      Returns:
      byte array of the backup data in event log format.
    • run

      public void run()
      Run the backup data service keep connection open to receive data and send to long term storage Message includes method calling and parameters Also accept incoming requests to retrieve backup data.
      Specified by:
      run in interface Runnable