• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Thread Pool in Java

 
Ranch Hand
Posts: 328
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,

I want to write Thread Poolusing Java for some repititve task which is controlled through Job Scheduler.Job Scheduler will run after interval of 2 minutes.Can you please provide me few guidelines regarding how to write thread pool in Java.

My application will be deployed on Application Server and I am using JDK 1.4. I know there is a java.util.concurrent.Executors class which can be used for this. However, It's available in JDK 1.5 & not in 1.4

Thanks,
Shriniwas
 
Wanderer
Posts: 18671
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can use the java.util.concurrent backport to get most of the concurrent functionality in earlier JDK versions. There are also other thread pool implementations out there, or you could write your own, but unless you're doing this as a learning exercise, using java.util.concurrent is probably easiest.
[ May 01, 2008: Message edited by: Jim Yingst ]
 
Ranch Hand
Posts: 61
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Creating a ThreadPool logically vary from people to people.The easiest of creating a thread pool is to use java data structure (Hashtable,Hashmap prefferably) and take boolean variable ,just to identify(whether this thread in use or not).This is somewhat similar to connection pool maintain by the webserver/Application server.

Hope above hint will be helpful for you in someway.

____________________________
Mintoo
SCJP 1.4
___________________________
 
If you open the box, you will find Heisenberg strangling Shrodenger's cat. And waving this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic