• Post Reply Bookmark Topic Watch Topic
  • New Topic

Design issue

 
visu Nekk
Ranch Hand
Posts: 122
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
We have a scenario, where we need to query a web service for data at regular intervals. We have four processes doing different jobs which query the web service. For this purpose, we went on to implement this scenario using TimerTask. Apart from this, do we have any other feasible solution. The problem with our implementation was, for every 3 minutes, a new thread will be spawned for each of the four processes. Because of that, if the current thread doesn't finish processing the retrieved data and storing them into the database, a huge amount of memory is being utilized. Please let me know if anyone has a better feasible solution for this purpose.
 
Nitesh Kant
Bartender
Posts: 1638
IntelliJ IDE Java MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
visu: if the current thread doesn't finish processing the retrieved data and storing them into the database, a huge amount of memory is being utilized.


Are you asking how to stop long running tasks?
If so then the only way to handle is to make the task respond to interrupts and after a given time you can either interrupt the running thread or use a Future and cancel it after a specified time.
You may wish to elaborate a little more as to what you want to do in order to help us help you better.
If your task itself is running for long then no other technology can help you out on this, whether you use TimerTask, Scheduling frameworks like quartz or whatever. The only thing you can do is to make the task either finish gracefully or honour an interruption.
 
Bill Shirley
Ranch Hand
Posts: 457
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
run a profiler on your application,
find out where it's spending most of its time,
 
Jack clouseau
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi all,

can somebody elaborate on the PROFILER thing....am new into this, so thought of knowing what does a profiler do and what info can we get from that.

Thanks

-----------------------------
A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea!!!
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!