Skip to content

Commit 2801def

Browse files
committed
Use poll instead remove to avoid exception
1 parent fbc50b0 commit 2801def

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

pulsar-broker/src/main/java/org/apache/pulsar/client/impl/RawReaderImpl.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,10 @@ protected CompletableFuture<Void> failPendingReceive() {
218218
private void failPendingRawReceives() {
219219
List<CompletableFuture<RawMessage>> toError = new ArrayList<>();
220220
while (!pendingRawReceives.isEmpty()) {
221-
toError.add(pendingRawReceives.remove());
221+
final CompletableFuture<RawMessage> ret = pendingRawReceives.poll();
222+
if (ret != null) {
223+
toError.add(ret);
224+
}
222225
}
223226
toError.forEach((f) -> f.cancel(false));
224227
}

0 commit comments

Comments
 (0)