Skip to content

Commit

Permalink
Added ability to ignore BalanceCache
Browse files Browse the repository at this point in the history
  • Loading branch information
ar committed Jun 22, 2018
1 parent 1e1391b commit c5bca32
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion modules/minigl/src/main/java/org/jpos/gl/GLSession.java
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ public class GLSession {
public static final BigDecimal ZERO = new BigDecimal ("0.00");
public static final BigDecimal Z = new BigDecimal ("0");
private long SAFE_WINDOW = 1000L;
private boolean ignoreBalanceCache = false;

/**
* Construct a GLSession for a given user.
Expand Down Expand Up @@ -1067,7 +1068,7 @@ else if (acct.isFinalAccount()) {
balance[0] = chkp.getBalance();
txnCrit.add (Restrictions.gt ("postDate", chkp.getDate()));
}
} else {
} else if (!ignoreBalanceCache) {
BalanceCache bcache = getBalanceCache (journal, acct, layersCopy);
if (bcache != null && bcache.getRef() <= maxId) {
balance[0] = bcache.getBalance();
Expand Down Expand Up @@ -1458,6 +1459,14 @@ else if (entry.isDecrease()) {
return balance;
}

public boolean isIgnoreBalanceCache() {
return ignoreBalanceCache;
}

public void setIgnoreBalanceCache(boolean ignoreBalanceCache) {
this.ignoreBalanceCache = ignoreBalanceCache;
}

// -----------------------------------------------------------------------
// PUBLIC HELPERS
// -----------------------------------------------------------------------
Expand Down

0 comments on commit c5bca32

Please sign in to comment.