#8293 fix concurrent access to PQ persisted bytesize throwing

Fixes #8317
This commit is contained in:
Armin 2017-09-19 17:36:53 +02:00 committed by Armin Braun
parent 9184e360d2
commit fc1b548a87

View file

@ -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() {