wood burning stoves 2.0*
The moose likes Threads and Synchronization and the fly likes Thread Pool in Java Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Threads and Synchronization
Bookmark "Thread Pool in Java" Watch "Thread Pool in Java" New topic
Author

Thread Pool in Java

Shrinivas Mujumdar
Ranch Hand

Joined: Aug 27, 2004
Posts: 328
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
Jim Yingst
Wanderer
Sheriff

Joined: Jan 30, 2000
Posts: 18671
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 ]

"I'm not back." - Bill Harding, Twister
Mintoo kumar
Ranch Hand

Joined: Aug 21, 2007
Posts: 61
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
___________________________
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Thread Pool in Java
 
Similar Threads
Upgrading from JDK 1.4 to JDK 5
Is it a BUG in WSSAD 5.0 ... strange behaviour.
Impact of version change of JDK/SDK
To scott and Henry
How to get thread dump in windows