https://bz.apache.org/bugzilla/show_bug.cgi?id=62012
Bug ID: 62012
Summary: Disposing POI temporary files in multithreaded system
Product: POI
Version: 3.17-FINAL
Hardware: Other
OS: Linux
Status: NEW
Severity: major
Priority: P2
Component: XSSF
Assignee: [email protected]
Reporter: [email protected]
Target Milestone: ---
Hi,
I'm using POI SXSSFWorkbook for creating XLSX files in multithreaded system.
Since i read that there are issues with disposing the temporary files in when
using the DefaultTempFileCreationStrategy (with poifiles directory), i created
each thread is own temporary directory:
private TempFileCreationStrategy createTempFileCreationStrategy(File
poiTempFileDirectory) {
return new TempFileCreationStrategy() {
@Override
public File createTempFile(String prefix, String suffix) throws
IOException {
if (!poiTempFileDirectory.exists()) {
poiTempFileDirectory.mkdir();
}
File newFile = File.createTempFile(prefix, suffix,
poiTempFileDirectory);
return newFile;
}
@Override
public File createTempDirectory(String prefix) throws IOException {
return null;
}
};
This is the code while finishing handling the SXSSFWorkbook object:
// Write the Stream and close it
workBook.write(outputStream);
outputStream.close();
} catch (FileNotFoundException e) {
throw e;
} catch (IOException e) {
throw e;
} catch (Exception e) {
throw e;
} finally {
//Close the workBook
workBook.close();
//deleting the temporary files
workBook.dispose();
}
But still, from time to time, i'm getting an exception during the dispose. One
thread is throwing exception while trying to delete the temporary files of
another thread and the message is:
"dc319a2c-a663-4cb7-9f13-f7e8cc14c186/poi-sxssf-sheet-xml6608967316211277648.gz
(No such file or directory)"
Thanks in advanced
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]