Forums Register Login

Information needed regarding allowCoreThreadTimeOut

+Pie Number of slices to send: Send
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
+Pie Number of slices to send: Send
 

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.
Are you here to take over the surface world? Because this tiny ad will stop you!
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 1864 times.
Similar Threads
J2EE
WA #2 ..... word association
zipping as self extracting exe
class
c++ or Java--your suggestions please
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 01:56:30.