• 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

Information needed regarding allowCoreThreadTimeOut

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello Everyone..

as far as i know, allowCoreThreadTimeOut is available only for Java 6.0 version of ThreadPoolExecutor.
Can anyone tell me how to use the allowCoreThreadTimeOut concept in Java 5.0..

With Regards
Allan
 
Bartender
Posts: 4179
22
IntelliJ IDE Python Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Allan Kuruvila wrote:Hello Everyone..

as far as i know, allowCoreThreadTimeOut is available only for Java 6.0 version of ThreadPoolExecutor.
Can anyone tell me how to use the allowCoreThreadTimeOut concept in Java 5.0..

With Regards
Allan



You have a few options:

1) Upgrade to Java 6.0
2) Write your own implementation that applies the allowCoreThreadTimeOut concept
3) If you set the CorePoolSize to 0, then you will allow all of your Threads to timeout. This has side effects, though. For example, Threads will only be created if the Queue used to hold backed up tasks is full. So if you have a queue of size 100, then 101 tasks must be submitted before a thread gets made. If you have an unbound queue then no threads ever get made. There are work-arounds for this problem (For example, using a SynchronousQueue and a RejectedExecutionHandler to attempt to re-reed tasks to the Executor if the MaxPoolSize is reached). But research all the side effects before using it just to be sure you know what you are getting into.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic