LuciferYang commented on PR #36484:
URL: https://github.com/apache/spark/pull/36484#issuecomment-1168187685

   In fact, the `cleaningThread` added by current pr in this pr is similar to 
`o.a.s.ContextCleaner#cleaningThread` and 
`o.a.s.storage.BlockManager.RemoteBlockDownloadFileManager#cleaningThread`.
   
   The difference is that the latter two allow `cleaningThread.interrupt()`  
but the `cleaningThread` added by current pr not allowed due to I want to to 
ensure the elements in `referenceQueue` are closed before `cleaningThread` 
stopped.
   
   I think `AutoCloseable`+ `java Lang.ref.Cleaner` maybe a better solution, 
`try-with-resources` has been used as much as possible in the current Spark 
code to ensure that `DBIterator` is closed,  but `Cleaner` is only supported 
after Java 9, So we can also wait until `Cleaner` is available before 
continuing to sort out this part of the code.
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to