mirror of
https://github.com/bisq-network/bisq.git
synced 2024-11-19 01:41:11 +01:00
Refactoring: Extract requestPersistence method
This commit is contained in:
parent
fa0c28adf6
commit
9517f427b6
@ -84,13 +84,13 @@ public class ClosedTradableManager implements PersistedDataHost {
|
||||
|
||||
public void add(Tradable tradable) {
|
||||
if (closedTradables.add(tradable)) {
|
||||
persistenceManager.requestPersistence();
|
||||
requestPersistence();
|
||||
}
|
||||
}
|
||||
|
||||
public void remove(Tradable tradable) {
|
||||
if (closedTradables.remove(tradable)) {
|
||||
persistenceManager.requestPersistence();
|
||||
requestPersistence();
|
||||
}
|
||||
}
|
||||
|
||||
@ -117,4 +117,8 @@ public class ClosedTradableManager implements PersistedDataHost {
|
||||
return getClosedTrades().stream()
|
||||
.filter(Trade::isFundsLockedIn);
|
||||
}
|
||||
|
||||
private void requestPersistence() {
|
||||
persistenceManager.requestPersistence();
|
||||
}
|
||||
}
|
||||
|
@ -95,13 +95,13 @@ public class FailedTradesManager implements PersistedDataHost {
|
||||
|
||||
public void add(Trade trade) {
|
||||
if (failedTrades.add(trade)) {
|
||||
persistenceManager.requestPersistence();
|
||||
requestPersistence();
|
||||
}
|
||||
}
|
||||
|
||||
public void removeTrade(Trade trade) {
|
||||
if (failedTrades.remove(trade)) {
|
||||
persistenceManager.requestPersistence();
|
||||
requestPersistence();
|
||||
}
|
||||
}
|
||||
|
||||
@ -129,7 +129,7 @@ public class FailedTradesManager implements PersistedDataHost {
|
||||
if (unFailTradeCallback.apply(trade)) {
|
||||
log.info("Unfailing trade {}", trade.getId());
|
||||
if (failedTrades.remove(trade)) {
|
||||
persistenceManager.requestPersistence();
|
||||
requestPersistence();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -151,4 +151,8 @@ public class FailedTradesManager implements PersistedDataHost {
|
||||
}
|
||||
return blockingTrades.toString();
|
||||
}
|
||||
|
||||
private void requestPersistence() {
|
||||
persistenceManager.requestPersistence();
|
||||
}
|
||||
}
|
||||
|
@ -536,7 +536,7 @@ public class P2PService implements SetupListener, MessageListener, ConnectionLis
|
||||
mailboxItemsByUid.putIfAbsent(uid, new ArrayList<>());
|
||||
mailboxItemsByUid.get(uid).add(mailboxItem);
|
||||
mailboxMessageList.add(mailboxItem);
|
||||
persistenceManager.requestPersistence();
|
||||
requestPersistence();
|
||||
|
||||
NodeAddress sender = mailboxMessage.getSenderNodeAddress();
|
||||
log.info("Received a {} mailbox message with uid {} and senderAddress {}",
|
||||
@ -818,7 +818,7 @@ public class P2PService implements SetupListener, MessageListener, ConnectionLis
|
||||
mailboxMessageList.remove(mailboxItem);
|
||||
});
|
||||
mailboxItemsByUid.remove(uid);
|
||||
persistenceManager.requestPersistence();
|
||||
requestPersistence();
|
||||
}
|
||||
});
|
||||
} else {
|
||||
@ -827,6 +827,10 @@ public class P2PService implements SetupListener, MessageListener, ConnectionLis
|
||||
}
|
||||
}
|
||||
|
||||
private void requestPersistence() {
|
||||
persistenceManager.requestPersistence();
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Data storage
|
||||
|
Loading…
Reference in New Issue
Block a user