Skip to content

use closeImmediatly() #13273

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,10 @@ default boolean shouldUpdate(BibEntry entry) {
}

void close();

/// Close the file and the store, without writing anything (if supported by the implementation).
/// This will stop the background thread. This method ignores all errors.
default void closeImmediately() {
close();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -141,4 +141,9 @@ boolean shouldUpdate(final BibEntry entry, final Clock clock) {
public void close() {
this.store.close();
}

@Override
public void closeImmediately() {
this.store.closeImmediately();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
import org.jabref.model.entry.field.StandardField;
import org.jabref.model.entry.identifier.DOI;
import org.jabref.model.entry.types.StandardEntryType;
import org.jabref.support.DisabledOnCIServer;

import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
Expand All @@ -37,7 +36,6 @@
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.mockito.Mockito.mock;

@DisabledOnCIServer("Strange out of memory exceptions, works with manual testing")
class MVStoreBibEntryRelationRepositoryTest {

private final static String MV_STORE_NAME = "test-relations.mv";
Expand All @@ -63,7 +61,7 @@ void initStore() throws Exception {

@AfterEach
void closeStore() {
this.dao.close();
this.dao.closeImmediately();
// On the CI, we sometimes get "OutOfMemoryException"s. This tries to prevent that.
System.gc();
}
Expand Down Expand Up @@ -234,7 +232,7 @@ public BibEntry read(ByteBuffer buffer) {

// WHEN
daoUnderTest.addRelations(entry, relations);
daoUnderTest.close();
daoUnderTest.closeImmediately();
daoUnderTest = new MVStoreBibEntryRelationRepository(file.toAbsolutePath(), MAP_NAME, 7, serializer);
List<BibEntry> deserializedRelations = daoUnderTest.getRelations(entry);

Expand Down
Loading