fbocse edited a comment on issue #90: Add finalizer for Hadoop streams to catch paths that don't call close. URL: https://github.com/apache/incubator-iceberg/pull/90#issuecomment-460625651 Afaik `Object.finalize()` isn't the best option out there for resource reclaiming, unless it's the only option, is it in this particular case? I'm thinking if it would work if we were to be looking into more naive alternatives such as having `HadoopSeekableInputStream` and `HadoopPositionOutputStream` both implement (which they already do) `java.lang.AutoCloseable` and just rely on always using `try-with-resources` when working with `com.netflix.iceberg.io.SeekableInputStream` instances from `com.netflix.iceberg.hadoop.HadoopStreams#wrap(org.apache.hadoop.fs.FSDataInputStream)`? I'm calling object finalization not the best option because it's basically nondeterministic, it depends on GC firing (that's basically a bunch of heuristics, might as well roll a dice), no guarantees to be called before program exits, no guarantees on the ordering in which JVM will invoke the objects' finalizer methods, all finalizers are treated "fairly" so objects holding on to considerable resources are queued up waiting for objects whose finalizers are slowly progressing, etc. of and also seeing as `Object.finalize()` has become deprecated with [Java 9](https://docs.oracle.com/javase/9/docs/api/java/lang/Object.html#finalize--) (most probably not going to go away any time soon though)
---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: [email protected] With regards, Apache Git Services --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
