mirror of
https://github.com/haveno-dex/haveno.git
synced 2025-08-05 05:04:15 -04:00
fix concurrency issues by synchronizing on base persistable list
This commit is contained in:
parent
3c6914ac7e
commit
9027ce6634
15 changed files with 262 additions and 220 deletions
|
@ -62,7 +62,9 @@ class SignedOffersDataModel extends ActivatableDataModel {
|
|||
private void applyList() {
|
||||
list.clear();
|
||||
|
||||
list.addAll(openOfferManager.getObservableSignedOffersList().stream().map(SignedOfferListItem::new).collect(Collectors.toList()));
|
||||
synchronized (openOfferManager.getObservableSignedOffersList()) {
|
||||
list.addAll(openOfferManager.getObservableSignedOffersList().stream().map(SignedOfferListItem::new).collect(Collectors.toList()));
|
||||
}
|
||||
|
||||
// we sort by date, the earliest first
|
||||
list.sort((o1, o2) -> new Date(o2.getSignedOffer().getTimeStamp()).compareTo(new Date(o1.getSignedOffer().getTimeStamp())));
|
||||
|
|
|
@ -206,15 +206,17 @@ public class GUIUtil {
|
|||
persistenceManager.readPersisted(fileName, persisted -> {
|
||||
StringBuilder msg = new StringBuilder();
|
||||
HashSet<PaymentAccount> paymentAccounts = new HashSet<>();
|
||||
persisted.getList().forEach(paymentAccount -> {
|
||||
String id = paymentAccount.getId();
|
||||
if (user.getPaymentAccount(id) == null) {
|
||||
paymentAccounts.add(paymentAccount);
|
||||
msg.append(Res.get("guiUtil.accountExport.tradingAccount", id));
|
||||
} else {
|
||||
msg.append(Res.get("guiUtil.accountImport.noImport", id));
|
||||
}
|
||||
});
|
||||
synchronized (persisted.getList()) {
|
||||
persisted.getList().forEach(paymentAccount -> {
|
||||
String id = paymentAccount.getId();
|
||||
if (user.getPaymentAccount(id) == null) {
|
||||
paymentAccounts.add(paymentAccount);
|
||||
msg.append(Res.get("guiUtil.accountExport.tradingAccount", id));
|
||||
} else {
|
||||
msg.append(Res.get("guiUtil.accountImport.noImport", id));
|
||||
}
|
||||
});
|
||||
}
|
||||
user.addImportedPaymentAccounts(paymentAccounts);
|
||||
new Popup().feedback(Res.get("guiUtil.accountImport.imported", path, msg)).show();
|
||||
},
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue