• 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 Pooling using jdk 1.5

 
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
author
Posts: 23951
142
jQuery Eclipse IDE Firefox Browser VI Editor C++ Chrome Java Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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
 
Achalveer Singh
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Ranch Hand
Posts: 148
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


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
Posts: 25
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i think forum is for discussing the problem . please discuss the problem it will be better.
 
(instanceof Sidekick)
Posts: 8791
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 wop bop a lu bop a womp bam boom! 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