Repository navigation
Remove usage of ObjectCleaner - #8064
Conversation
|
@jasontedor @johnou FYI as well... When working on this I also noticed that the docs not really said that |
|
So with this and #8062 there is no more need to use The behaviour of This was introduced in 4.1.20.Final |
|
I have also another idea to still somehow guarantee the call of |
| Link head = link; | ||
| while (head != null) { | ||
| reclaimSpace(LINK_CAPACITY); | ||
| head = head.next; |
|
So my other idea was basically to have a |
|
@normanmaurer I would stick with finalize until Java 9 to avoid adding unnecessary complexity unless there is a clear performance gain. |
bryce-anderson
left a comment
There was a problem hiding this comment.
LGTM, but note that I'm light on context.
| try { | ||
| super.finalize(); | ||
| } finally { | ||
| Link head = link; |
There was a problem hiding this comment.
optional: destroy link after this
Motivation: ObjectCleaner does start a Thread to handle the cleaning of resources which leaks into the users application. We should not use it in netty itself to make things more predictable. Modifications: - Remove usage of ObjectCleaner and use finalize as a replacement when possible. - Clarify javadocs for FastThreadLocal.onRemoval(...) to ensure its clear that remove() is not guaranteed to be called when the Thread completees and so this method is not enough to guarantee cleanup for this case. Result: Fixes #8017.
Motivation:
ObjectCleaner does start a Thread to handle the cleaning of resources which leaks into the users application. We should not use it in netty itself to make things more predictable.
Modifications:
Result:
Fixes #8017.