I am writing file and closing stream after writing. In finally I am deleting file. But I am still able to find file after program execution is complete. Its Multi threaded environment.
So is it possible to check it is being used by which function or which thread?
Updated with code :
File p_file = new File("C:\\", "GUID");
p_file.createNewFile();
FileOutputStream fos = null;
try {
fos = new FileOutputStream(p_file);
fos.write("This is test msg.".getBytes());
} finally {
try {
fos.close();
} catch (IOException e) {
e.printStackTrace();
}
if(p_file.exists())
System.out.println(p_file.delete());
}
}
Thanks