Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use shutdown hook to delete temp files instead of File.deleteOnExit (#…
…4578) * Use shutdown hook to delete temp files instead of File.deleteOnExit Previously, the JRubyClassLoader would make a .deleteOnExit() call for the temp directory and each temp file it needed to create. This results in the string for each registered path being stored in a hash that increases each time a new URL is loaded or new ScriptingContainer is created. This commit removes the .deleteOnExit() calls and instead registers a shutdown hook just after the temp directory is initially created. At shutdown time, the hook would delete any remaining files and the temp directory itself. This should effectively result in the same user behavior as before but with the benefit of the temp path strings no longer taking up an increasing amount of memory the longer the process runs. * Wrap exceptions for JRubyClassLoader shutdown delete with log statements For any cases where the shutdown hook in the JRubyClassLoader encounters an exception when trying to cleanup temp files, the exception should now be caught and logged.