• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

Multithreading Java ETL's programs

 
Ranch Hand
Posts: 70
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
(instanceof Sidekick)
Posts: 8791
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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/
 
reply
    Bookmark Topic Watch Topic
  • New Topic