lz4 / lz4-java

LZ4 compression for Java
Apache License 2.0
1.1k stars 253 forks source link

StreamingXXHash issues #131

Open leventov opened 5 years ago

leventov commented 5 years ago

1) StreamingXXHash32JNI and StreamingXXHash64JNI should not override finalize(), it's bad for GC. Instead, they should use Cleaner. 2) They should support close() for explicit resource release. 3) The close() method should be synchronized to avoid racy free, this is a workaround in the absence of Reference.reachabilityFence().

odaira commented 5 years ago

Thanks for the issue report.

  1. Agree, and I don't have a plan to upgrade to Java 9 in the near future, but will use Cleaner then.
  2. I'll work on it. Do you think it should implement the Closeable interface?
  3. Agree. I think all the other methods (reset, getValue, and update) must also be synchronized, correct?
leventov commented 5 years ago
  1. Yes
  2. Yes