public class LeaseDTO extends Object
| Modifier and Type | Field and Description |
|---|---|
static String |
BALANCE_FIELD
Redis cluster balance field constant key.
|
static long |
WAIT_TIME_BEFORE_FULL_RELEASE
When a 100% (full) balance return request is made for an account, Balance manager will not process
any further full amount return request for WAIT_TIME_BEFORE_FULL_RELEASE
|
| Constructor and Description |
|---|
LeaseDTO(long accountID,
BalanceManager balanceManager)
Create a
LeaseDTO instance for the given account id |
| Modifier and Type | Method and Description |
|---|---|
void |
decreaseLeaseAmount(double extraLease)
Extra amount left at the end of the call is added to the lease (make sure to provide +ve
value).
|
void |
executeLuaScript(String luaFileName,
redis.clients.jedis.JedisCluster jedisCluster,
String leaseKey)
Method to execute loaded lua script in the Redis cluster
|
long |
getAccountID() |
double |
getAvailableLocalBalance() |
double |
getLease(double lease)
Try to get a lease from this account balance.
|
void |
returnAvailableBalancePercentage(double percentage)
A percentage of available balance for this account will be returned to redis cluster when this method is called.
|
void |
setFrozen(boolean frozen)
Setter for freeze/unfreeze state of an account
|
public static final String BALANCE_FIELD
public static final long WAIT_TIME_BEFORE_FULL_RELEASE
public LeaseDTO(long accountID,
BalanceManager balanceManager)
LeaseDTO instance for the given account idaccountID - Account id for balance informationbalanceManager - Parent BalanceManager instance from where this LeaseDTO instance is being maintained.public double getLease(double lease)
lease - The amount to be added to the leasepublic void decreaseLeaseAmount(double extraLease)
extraLease - remaining lease amount. make sure that it's +vepublic void returnAvailableBalancePercentage(double percentage)
percentage - What percentage of the available will be returned. For a full return percentage will be 100public void executeLuaScript(String luaFileName, redis.clients.jedis.JedisCluster jedisCluster, String leaseKey)
luaFileName - The lua script file to be executedjedisCluster - Redis cluster where the script is intended to be executedleaseKey - Key for which the value will be set in Redispublic long getAccountID()
public double getAvailableLocalBalance()
public void setFrozen(boolean frozen)
frozen - Copyright © 2021. All rights reserved.