Skip to content

Comments

ACCUMULO-4318 Made writers and scanners auto closeable#104

Closed
keith-turner wants to merge 2 commits intoapache:1.8from
keith-turner:ACCUMULO-4318
Closed

ACCUMULO-4318 Made writers and scanners auto closeable#104
keith-turner wants to merge 2 commits intoapache:1.8from
keith-turner:ACCUMULO-4318

Conversation

@keith-turner
Copy link
Contributor

No description provided.

@dhutchis
Copy link
Member

One thought--- a client might open a BatchScanner in a try-with-resources block but save a reference to scanner.iterator() and use that outside the block. If so the client will fail because the BatchScanner will close the query thread pool that the TabletServerBatchReader uses. It would be good to advise users in the documents not to do this.

@joshelser
Copy link
Member

That's a very good point, @dhutchis. I think I've seen really weird things in the same manner where a BatchScanner falls out of scope, the finalizer closes it, and then invalidates the iterator being iterated over (in a for-each loop). I think @wjsl also hit this before.

@keith-turner
Copy link
Contributor Author

It would be good to advise users in the documents not to do this.

I can add some javadoc on the close methods.

@joshelser
Copy link
Member

Noticed that you also added some closing of Scanners that were left to auto-close on GC

@keith-turner
Copy link
Contributor Author

Noticed that you also added some closing of Scanners that were left to auto-close on GC

No exactly sure what you mean. Can you point it out with a comment?

@joshelser
Copy link
Member

No exactly sure what you mean. Can you point it out with a comment?

Maybe close by GC is wrong (I forget if we actually have a finalizer on it now). But, anyways, you added some close calls on Scanners :)

https://github.com/apache/accumulo/pull/104/files#diff-34221dcf488e3b53687222557d82b2f1R300

@keith-turner
Copy link
Contributor Author

Maybe close by GC is wrong (I forget if we actually have a finalizer on it now). But, anyways, you added some close calls on Scanners :)

ok. Introducing Autocloseable introduced lots of warnings in the code. I was just trying to suppress the warnings. When I did this I was thinking Scanners don't have to be closed, so don't need to use try-with-resources. However this could change in the future and the warnings will not be there. I'll change those to use try-with-resources.

@keith-turner
Copy link
Contributor Author

Merged this to 1.8. Thanks @joshelser and @dhutchis for taking a look.

@keith-turner keith-turner deleted the ACCUMULO-4318 branch December 6, 2018 15:18
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.

3 participants