REQ-3828: fix concurrency issue

This commit is contained in:
yanglin 2024-12-26 09:38:15 +08:00
parent f75b5cca1a
commit cafef633a6
2 changed files with 3 additions and 1 deletions

View File

@ -13,6 +13,7 @@ import lombok.Setter;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
@ -26,7 +27,7 @@ public class CardSendModel {
private final CardRequestContext<CardSendRequest> requestContext;
private final CardTemplate cardTemplate;
private final List<Card> cards = new ArrayList<>();
private final List<Card> cards = Collections.synchronizedList(new ArrayList<>());
private GeneralMessagePushVO cardContent;

View File

@ -36,6 +36,7 @@ public class RecordCursor<T> implements Iterable<List<T>> {
return new Iterator<List<T>>() {
long maxId = 0;
// single thread producer
volatile List<T> batch;
Boolean batchConsumed;