|
|
|
As I mentioned in the issue that Adding a finalize method will delay cleaning up the memory. I know it sounds good to provide finalizer as a safety net in case the client of this class fail to call dispose method explictly. I know Bill will say no finalizer
Anyway I will keep finalizer for now. Following is the code that I am about to commit. protected void finalize() throws Throwable { /**
-dispose( ) method is added to delete the temp files associated with this
object. -The finalizer is now properly implemented and it calls dispose() method. finalizer should never be used to release resources since finalizer are unpredictable.
I just took snapshot from our production system and found few MultiPartDataSource Objects
held in memory blaming the finalizer. I am going to remove the finalizer from this class. I created this issue by mistake. I thought I forgot to add it in JASIG jira. Sorry for inconvenience.
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Do we still need to implement the finalizer to call dispose() so that in the case where our client failed to call dispose() and just dropped its reference to the MultipartDataSource instance, we will clean up the file system resources that we were using? Calling dispose() in the finalizer may be necessary to guarantee cleanup of external resources?