9.16.1 Overview
In an application that defines OS resource release processing in the finalize() method, the finalization processing might be retained and delays in the release of OS resources might occur. If you use the finalize-retention resolution function, whether finalization processing is retained in JavaVM is detected and the retained finalization processing is resolved.
The finalize-retention resolution function creates a finalization processing monitoring thread that monitors FinalizerThread when Java starts in order to detect the retention of finalization processing. FinalizerThread is a thread that is always present when Java is executed and processes the finalize() methods of objects one by one.
The finalization processing monitoring thread periodically monitors the objects being processed by FinalizerThread. If the following conditions are met, the finalization processing is considered to be retained and a new finalization thread is created.
-
The finalization processing of the objects is not progressing in FinalizerThread.
-
There is an object in the finalization queue.
Both FinalizerThread and the finalization thread execute the finalization processing to facilitate the resolution of the retained finalization processing. Note that the finalization thread ends when the finalization queue becomes empty.