Clean queues

This commit is contained in:
Andrea Cavalli 2021-10-25 01:44:12 +02:00
parent 7a01b6a2a4
commit f9b656986c
2 changed files with 16 additions and 0 deletions

View File

@ -244,6 +244,14 @@ public class LMDBArray<V> implements IArray<V>, Closeable {
public void close() throws IOException {
if (closed.compareAndSet(false, true)) {
ensureThread();
for (ByteBuf toWriteKey : toWriteKeys) {
toWriteKey.release();
}
for (ByteBuf toWriteValue : toWriteValues) {
toWriteValue.release();
}
toWriteKeys.clear();
toWriteValues.clear();
if (rwTxn != null) {
rwTxn.close();
}

View File

@ -498,6 +498,14 @@ public class LMDBPriorityQueue<T> implements PriorityQueue<T>, Reversable<Revers
public void close() throws IOException {
if (closed.compareAndSet(false, true)) {
ensureThread();
for (ByteBuf toWriteKey : toWriteKeys) {
toWriteKey.release();
}
for (ByteBuf toWriteValue : toWriteValues) {
toWriteValue.release();
}
toWriteKeys.clear();
toWriteValues.clear();
if (cur != null) {
cur.close();
}