File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Thread Pool in Java

 
Shrinivas Mujumdar
Ranch Hand
Posts: 328
  • 0
  • Mark post as helpful
  • send pies
  • 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
 
Jim Yingst
Wanderer
Sheriff
Posts: 18671
  • 0
  • Mark post as helpful
  • send pies
  • 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 ]
 
Mintoo kumar
Ranch Hand
Posts: 61
  • 0
  • Mark post as helpful
  • send pies
  • 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
___________________________
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic