Class MultipartTempFileTracker
A multipart part larger than the factory's threshold is written to a temp
file, and a file part is then handed to the service as a DataHandler
that reads it during invocation. That makes the file's useful life longer
than the build step, so the builder cannot simply delete it on the way out —
which is why these files previously accumulated for the lifetime of the JVM.
Cleanup is therefore tied to reachability: commons-io tracks each temp file
against its DiskFileItem through a phantom reference and deletes the
file once that item is collected. Form-field parts do not need to wait, and
the builder deletes those itself as soon as it has copied the text out.
The reaper is a daemon thread created on the first multipart request, so a
deployment that never receives one never starts it. shutdown() stops
it, and is called when the Axis2 configuration is cleaned up so the thread
does not outlive a redeployment.
-
Method Summary
Modifier and TypeMethodDescriptionstatic intHow many temp files are still awaiting deletion.static org.apache.commons.io.FileCleaningTrackerThe tracker to register temp files with, started on first use.static voidshutdown()Stop the reaper once the files it is still tracking have been deleted.
-
Method Details
-
getTracker
public static org.apache.commons.io.FileCleaningTracker getTracker()The tracker to register temp files with, started on first use.A tracker that has been shut down cannot be restarted, so this creates a fresh one rather than handing back a dead reaper if a configuration is cleaned up and another is built in the same JVM.
-
shutdown
public static void shutdown()Stop the reaper once the files it is still tracking have been deleted. -
getTrackedFileCount
public static int getTrackedFileCount()How many temp files are still awaiting deletion. Intended for tests and diagnostics.
-