mirror of
https://github.com/elastic/logstash.git
synced 2025-04-24 06:37:19 -04:00
#8293 fix concurrent access to PQ persisted bytesize throwing
Fixes #8317
This commit is contained in:
parent
9184e360d2
commit
fc1b548a87
1 changed files with 12 additions and 7 deletions
|
@ -139,14 +139,19 @@ public class Queue implements Closeable {
|
|||
}
|
||||
|
||||
public long getPersistedByteSize() {
|
||||
final long size;
|
||||
if (headPage == null) {
|
||||
size = 0L;
|
||||
} else {
|
||||
size = headPage.getPageIO().getHead()
|
||||
+ tailPages.stream().mapToLong(p -> p.getPageIO().getHead()).sum();
|
||||
lock.lock();
|
||||
try {
|
||||
final long size;
|
||||
if (headPage == null) {
|
||||
size = 0L;
|
||||
} else {
|
||||
size = headPage.getPageIO().getHead()
|
||||
+ tailPages.stream().mapToLong(p -> p.getPageIO().getHead()).sum();
|
||||
}
|
||||
return size;
|
||||
} finally {
|
||||
lock.unlock();
|
||||
}
|
||||
return size;
|
||||
}
|
||||
|
||||
public int getPageCapacity() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue