diff --git a/jablib/src/main/java/org/jabref/logic/citation/repository/BibEntryRelationRepository.java b/jablib/src/main/java/org/jabref/logic/citation/repository/BibEntryRelationRepository.java index f58e495a02c..ae255dc0abc 100644 --- a/jablib/src/main/java/org/jabref/logic/citation/repository/BibEntryRelationRepository.java +++ b/jablib/src/main/java/org/jabref/logic/citation/repository/BibEntryRelationRepository.java @@ -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(); + } } diff --git a/jablib/src/main/java/org/jabref/logic/citation/repository/MVStoreBibEntryRelationRepository.java b/jablib/src/main/java/org/jabref/logic/citation/repository/MVStoreBibEntryRelationRepository.java index f3c6fe55e85..1213a9479d3 100644 --- a/jablib/src/main/java/org/jabref/logic/citation/repository/MVStoreBibEntryRelationRepository.java +++ b/jablib/src/main/java/org/jabref/logic/citation/repository/MVStoreBibEntryRelationRepository.java @@ -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(); + } } diff --git a/jablib/src/test/java/org/jabref/logic/citation/repository/MVStoreBibEntryRelationRepositoryTest.java b/jablib/src/test/java/org/jabref/logic/citation/repository/MVStoreBibEntryRelationRepositoryTest.java index d7f057b97d9..388dd930168 100644 --- a/jablib/src/test/java/org/jabref/logic/citation/repository/MVStoreBibEntryRelationRepositoryTest.java +++ b/jablib/src/test/java/org/jabref/logic/citation/repository/MVStoreBibEntryRelationRepositoryTest.java @@ -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; @@ -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"; @@ -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(); } @@ -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 deserializedRelations = daoUnderTest.getRelations(entry);