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.
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 #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.
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 athrows IOException
to throw exception instead of a random runtime exception (probably a NPE) in case of error.Old HDTManager.java
New HDTManager.java
Core Changes
Main
close()
andtry-resource
in many methods.IOUtil.cleanBuffer(...)
method andCloseMappedByteBuffer
class to clean byte buffer, this is using the Unsafe due to a JVM exception.IOUtil.mapChannel(...)
method to create mapped file memory to trace mapped memory cleaning (for test)sizeBit mod MAPPING_SIZE = 0
Tests
close()
andtry-resource
in many tests.LongArrayDisk
class.AbstractMapMemoryTest
utility class to test mapped memory allocation.Workflow
.github/workflows/mvn-windows.yaml
file, I can remove it if asked.