I have a quartz scheduler job which scans a directory every 10 seconds and convert all pcl files to pdf files.
Here I put part of the code which scans the directory and loads all the files and for each of it it calls some methods to convert it.
FileExtensionFilter extFilter = new FileExtensionFilter();
extFilter.setAllowAll(false);
extFilter.addExtension(_fExtension);
// Filter out all files that match.
File[] filteredFileList = fInbox.listFiles(extFilter);
for (File fSrc : filteredFileList) {
try {
//call the methods to convert fSrc file
}catch (Exception e){
//threat exception's code
}
All works nice if I have 30 pcl files but if I have 50 for instance, the processing goes step by step slower.
The question is: is there any way to improve this loop? Basically to not "wait" for the file to be processed but go further and take another one and so one?
I'm thinking about multithreading but I am not sure if this will work on this filesystem scan conversion task... Can you suggest something?
Thanks.
Ps: Please note that If I throw 30 files, and after that another 30 all works great. The performance is affected when I throw at once more files...