You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@iceberg.apache.org by GitBox <gi...@apache.org> on 2019/02/05 14:01:46 UTC
[GitHub] fbocse edited a comment on issue #90: Add finalizer for Hadoop
streams to catch paths that don't call close.
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)`?
Afaik object finalization is complicated 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--)
----------------------------------------------------------------
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:
users@infra.apache.org
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org