Class MitigatorImpl

java.lang.Object
com.reve.balancemanager.mitigation.Mitigator
com.reve.balancemanager.impl.MitigatorImpl
All Implemented Interfaces:
Callable<Boolean>

public class MitigatorImpl extends Mitigator
Thread class which will work on balance sync for a specified account
  • Constructor Details

    • MitigatorImpl

      public MitigatorImpl()
  • Method Details

    • init

      public void init(BalanceManager balanceManager, long accountID, Double balance, Double credit)
      Initialize the instance specifying the account for which this thread will be called and under which mitigator this thread will work
      Specified by:
      init in class Mitigator
      Parameters:
      accountID - the account for which balance sync between MySQL and Redis will happen
      balance - Balance amount present in mysql for this account id.
      credit - Credit amount present in mysql for this account id.
      balanceManager - BalanceMitigator reference for mitigator
    • call

      public Boolean call()
    • addBMToACKSet

      public void addBMToACKSet(String bmID)
      Add the name of the balance manager in the ack received list. When account freeze ACK is received from any balance manager, this method should be called to add the name in the list.
      Specified by:
      addBMToACKSet in class Mitigator
      Parameters:
      bmID - Identification name of the balance manager
    • addBMToFrozenSet

      public void addBMToFrozenSet(String bmID)
      Add the name of the balance manager in the account freeze complete message received list. When account freeze complete is received from any balance manager, this method should be called to add the name in the list.
      Specified by:
      addBMToFrozenSet in class Mitigator
      Parameters:
      bmID - Identification name of the balance manager
    • addBMToUnfrozenSet

      public void addBMToUnfrozenSet(String bmID)
      Add the name of the balance manager in the account unfrozen complete received list. When account unfreeze complete is received from any balance manager, this method should be called to add the name in the list.
      Specified by:
      addBMToUnfrozenSet in class Mitigator
      Parameters:
      bmID - Identification name of the balance manager