Exhaust iterators before finishing transaction.
Use try-with-resources.
Added Leo Quote
Avoid deprecated API in docs. Make server plugin examples work.