What is `Cleaner` API in Java 9+ and how does it improve over `finalize()`?
Key points
- Cleaner API registers cleanup actions for phantom-reachable objects
- Avoids performance and ordering problems of finalize()
- Does not resurrect the object after cleanup
- Cleaner is not a replacement for garbage collection or a faster version of finalize()
Ready to go further?
