my dog learned polymorphism*
The moose likes Threads and Synchronization and the fly likes Thread Pooling using jdk 1.5 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Threads and Synchronization
Bookmark "Thread Pooling using jdk 1.5 " Watch "Thread Pooling using jdk 1.5 " New topic
Author

Thread Pooling using jdk 1.5

Achalveer Singh
Greenhorn

Joined: Sep 22, 2006
Posts: 25
hi all,
please tell me how i should implement thread pooling using jdk1.5 .
by using java.util.concurrent.* package.
what i have to do.

i have to make a class and i have to put for loop that send continuously message . thread pool of size 100 threads. when more then 100 message are coming then there should be queue for message.

please give me code if anyone has for this application.


ACHALVEER SINGH<br />SOFTWARE ENGINEER
Henry Wong
author
Sheriff

Joined: Sep 28, 2004
Posts: 18500
    
  40

Originally posted by Achalveer Singh:
hi all,
please tell me how i should implement thread pooling using jdk1.5 .
by using java.util.concurrent.* package.
what i have to do.

i have to make a class and i have to put for loop that send continuously message . thread pool of size 100 threads. when more then 100 message are coming then there should be queue for message.

please give me code if anyone has for this application.


Threadpool support is built into Java 5 -- no need to implement it.

Take a look at the java.util.concurrent.Executors class. This is a convenience factory for the creation of the most common configurations of threadpools.

Henry


Books: Java Threads, 3rd Edition, Jini in a Nutshell, and Java Gems (contributor)
Achalveer Singh
Greenhorn

Joined: Sep 22, 2006
Posts: 25
yes i know java 1.5 provides thread pool.
but i want to know how to use it according to my question.
please read question first before answering.
Hung Tang
Ranch Hand

Joined: Feb 14, 2002
Posts: 148

please give me code if anyone has for this application.

Achalveer, here's a tip: no one is going to do your homework for you.

please read question first before answering.

<sarcasm>This will surely get you some help.</sarcasm>

Why don't you go do some research on your own and come back with some real results before mouthing off in the forums.
Achalveer Singh
Greenhorn

Joined: Sep 22, 2006
Posts: 25
i think forum is for discussing the problem . please discuss the problem it will be better.
Stan James
(instanceof Sidekick)
Ranch Hand

Joined: Jan 29, 2003
Posts: 8791
Did you try the Javadoc linked above? The Executor interface page might also be a good starting point. There are code samples and more.

In short, you call Executors to get a concrete Executor implementation. Then you give the Executor a bunch of tasks to run. That's about it. What specific questions does that raise for you?
[ April 05, 2007: Message edited by: Stan James ]

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. John Ciardi
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Thread Pooling using jdk 1.5
 
Similar Threads
How to configure Thread pool in JBOSS
Entity Bean Instance Pooling
increase the response time of a jsp page
Thread Pooling in java
why should i use connection pooling ?