• Post Reply Bookmark Topic Watch Topic
  • New Topic

find maching files in list  RSS feed

 
Raj chiru
Ranch Hand
Posts: 142
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a directory where a lot of files are saved Like

Template_ Batch120408.txt, Template_ Batch120409.txt, Template_ Batch120410.txt, Template_ Batch120411.txt, Template_ Batch120412.txt, Template_ Batch120413.txt, Batch120408.txt, Batch120409.txt, Batch120410.txt, Batch120411.txt, Batch120412.txt, Batch120413.txt,

Currently there is a task which lists the files from directory and find the machingTemplate_ Batch file corresponding Batch120413 file(Batch120413.txt==>Template_ Batch120413.txt) from list and processes them sequentially (writing to a database). Due to the increasing number of files it is necessary to implement parallel processing of these files. Can you give me some ideas and a code example in java, please?
 
Martin Vajsar
Sheriff
Posts: 3752
62
Chrome Netbeans IDE Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You need to find out where the bottleneck of the current solution is. If it is a database, or IO operations (disc, network), doing things in parallel will make it actually perform worse, not better. To actually benefit from making things parallel, you'd have to do lots of processing over the files locally (in Java); if you're only writing them to the database, that's probably not the case.

It is actually quite possible that you could speed up database processing. Do you use PreparedStatement and JDBC update batching in your current solution? You might also show us your code and say what database are you using, somebody might have some tips on speeding things up there.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!