DeleteFileOnExitHook Class — netty Architecture
Architecture documentation for the DeleteFileOnExitHook class in DeleteFileOnExitHook.java from the netty codebase.
Entity Profile
Dependency Diagram
graph TD 9b83b4c7_ac79_a78f_c3cb_80359c7bd439["DeleteFileOnExitHook"] 07c5777a_a53a_08f7_cfdc_81a8a333a0f6["DeleteFileOnExitHook.java"] 9b83b4c7_ac79_a78f_c3cb_80359c7bd439 -->|defined in| 07c5777a_a53a_08f7_cfdc_81a8a333a0f6 5e1e5d56_96ca_03a0_90d0_a57e1abbbe36["DeleteFileOnExitHook()"] 9b83b4c7_ac79_a78f_c3cb_80359c7bd439 -->|method| 5e1e5d56_96ca_03a0_90d0_a57e1abbbe36 eda4a954_1b73_0acd_15b1_83a63f04a071["remove()"] 9b83b4c7_ac79_a78f_c3cb_80359c7bd439 -->|method| eda4a954_1b73_0acd_15b1_83a63f04a071 dfa556b9_6af6_c286_0584_33c19462f616["add()"] 9b83b4c7_ac79_a78f_c3cb_80359c7bd439 -->|method| dfa556b9_6af6_c286_0584_33c19462f616 cf9781f3_de67_f149_2afe_d3f0d9534886["checkFileExist()"] 9b83b4c7_ac79_a78f_c3cb_80359c7bd439 -->|method| cf9781f3_de67_f149_2afe_d3f0d9534886 b5f56c92_0843_fb2b_a355_2ceb6ea0e624["runHook()"] 9b83b4c7_ac79_a78f_c3cb_80359c7bd439 -->|method| b5f56c92_0843_fb2b_a355_2ceb6ea0e624
Relationship Graph
Source Code
codec-http/src/main/java/io/netty/handler/codec/http/multipart/DeleteFileOnExitHook.java lines 25–81
final class DeleteFileOnExitHook {
private static final Set<String> FILES = ConcurrentHashMap.newKeySet();
private DeleteFileOnExitHook() {
}
static {
// DeleteOnExitHook must be the last shutdown hook to be invoked.
// Application shutdown hooks may add the first file to the
// delete on exit list and cause the DeleteOnExitHook to be
// registered during shutdown in progress.
Runtime.getRuntime().addShutdownHook(new Thread() {
@Override
public void run() {
runHook();
}
});
}
/**
* Remove from the pool to reduce space footprint.
*
* @param file tmp file path
*/
public static void remove(String file) {
FILES.remove(file);
}
/**
* Add to the hook and clean up when the program exits.
*
* @param file tmp file path
*/
public static void add(String file) {
FILES.add(file);
}
/**
* Check in the hook files.
*
* @param file target file
* @return true or false
*/
public static boolean checkFileExist(String file) {
return FILES.contains(file);
}
/**
* Clean up all the files.
*/
static void runHook() {
for (String filename : FILES) {
new File(filename).delete();
}
}
}
Source
Frequently Asked Questions
What is the DeleteFileOnExitHook class?
DeleteFileOnExitHook is a class in the netty codebase, defined in codec-http/src/main/java/io/netty/handler/codec/http/multipart/DeleteFileOnExitHook.java.
Where is DeleteFileOnExitHook defined?
DeleteFileOnExitHook is defined in codec-http/src/main/java/io/netty/handler/codec/http/multipart/DeleteFileOnExitHook.java at line 25.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free