Skip to content
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

Fix non closed files #164

Merged
merged 2 commits into from
Jul 18, 2022
Merged

Fix non closed files #164

merged 2 commits into from
Jul 18, 2022

Conversation

ate47
Copy link
Contributor

@ate47 ate47 commented Jul 9, 2022

This pull request fix (I hope) all the non closed files and mapped buffer in HDT-JAVA-CORE, the main idea is to make it work on Windows, more strict on not closed files.

API Changes

I've added to the indexedHDT(...) method a throws IOException to throw exception instead of a random runtime exception (probably a NPE) in case of error.

Old HDTManager.java

HDT indexedHDT(HDT hdt, ProgressListener listener)
protected abstract HDT doIndexedHDT(HDT hdt, ProgressListener listener)

New HDTManager.java

HDT indexedHDT(HDT hdt, ProgressListener listener) throws IOException
protected abstract HDT doIndexedHDT(HDT hdt, ProgressListener listener) throws IOException

Core Changes

Main

  • add close() and try-resource in many methods.
  • add IOUtil.cleanBuffer(...) method and CloseMappedByteBuffer class to clean byte buffer, this is using the Unsafe due to a JVM exception.
  • add IOUtil.mapChannel(...) method to create mapped file memory to trace mapped memory cleaning (for test)
  • Remove try-catch without throwing added in Fix HDTcat to work under Windows #128.
  • fix LongArrayDisk if sizeBit mod MAPPING_SIZE = 0

Tests

  • add close() and try-resource in many tests.
  • remove prints in HDTCat tests.
  • add test for the LongArrayDisk class.
  • add AbstractMapMemoryTest utility class to test mapped memory allocation.

Workflow

  • I've added a Java CI version for Windows to test the library in a Windows environment in the .github/workflows/mvn-windows.yaml file, I can remove it if asked.

ate47 added 2 commits July 8, 2022 11:37
…anager#indexedHDT(), remove many unhandled try/catch, remove unhandled try/catch added in rdfhdt#128 and fix LongArrayDisk if sizeBit % MAPPING_SIZE == 0
@D063520 D063520 merged commit 7a313d0 into rdfhdt:master Jul 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants