fix concurrency issues by synchronizing on base persistable list

This commit is contained in:
woodser 2025-04-06 17:43:23 -04:00 committed by woodser
parent 3c6914ac7e
commit 9027ce6634
15 changed files with 262 additions and 220 deletions

View file

@ -48,12 +48,14 @@ public class MailboxMessageList extends PersistableList<MailboxItem> {
@Override
public Message toProtoMessage() {
return protobuf.PersistableEnvelope.newBuilder()
.setMailboxMessageList(protobuf.MailboxMessageList.newBuilder()
.addAllMailboxItem(getList().stream()
.map(MailboxItem::toProtoMessage)
.collect(Collectors.toList())))
.build();
synchronized (getList()) {
return protobuf.PersistableEnvelope.newBuilder()
.setMailboxMessageList(protobuf.MailboxMessageList.newBuilder()
.addAllMailboxItem(getList().stream()
.map(MailboxItem::toProtoMessage)
.collect(Collectors.toList())))
.build();
}
}
public static MailboxMessageList fromProto(protobuf.MailboxMessageList proto,