Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Multithreading Java ETL's programs  RSS feed

 
Prabha Dhandapani
Ranch Hand
Posts: 70
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello everybody,
I have a set of Java Programs that access data from different tables in the databse, make some chages to the data, populate the data and also do so clean up work.
I am supposed to multi thread these programs as they take hours to do this job one by one.
I have no experience in writing threaded programs.Can somebody tell me what to do and where to start?
All the Java programs have a main thread now!
I read some tutorials about threading but did not get any idea related to threading the Java programs. Can somebody help me with this?It is very very urgent!
Many Thanks in Advance,
Prabha
 
Pierre Henry
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ho�,
There is a jakarta project called DBCP which you can find at
dbcp, and that
certainly responds to your needs
 
Stan James
(instanceof Sidekick)
Ranch Hand
Posts: 8791
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you're completely new to threads, google for "sun thread tutorial". Here's one http://java.sun.com/docs/books/tutorial/essential/threads/ but other folks may recommend other starting points.
If you have multiple tasks to perform against the database, encapsulate each one in an object (command pattern). Make each one implement Runnable,
put the guts of the job in the run() method, and start them all up at once:

Multiple tasks can run faster together than serially because one gets CPU time while another is waiting on a database operation. It is certainly possible to start too many all at once. I don't know what the limit would be, but if things really seem to slow down with a zillion running at once, look into the Jakarta Commons thread pool. It looks pretty simple to use. http://jakarta.apache.org/commons/sandbox/threadpool/
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!