Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #32829
| From | Jeff Higgins <jeff@invalid.invalid> |
|---|---|
| Newsgroups | comp.lang.java.programmer |
| Subject | Re: WorkStealingPool |
| Date | 2015-10-06 19:00 -0400 |
| Organization | A noiseless patient Spider |
| Message-ID | <mv1jni$m66$1@dont-email.me> (permalink) |
| References | <0c4a62cb-9e0f-4118-8198-fba1df61d825@googlegroups.com> |
On 10/05/2015 03:42 PM, H.L@operamail.com wrote:
>
> Can anyone understand why this example of a WorkStealingpool does not work?
> It only does a few of the urls that it was supposed to fetch.
> The key is the runAsExecutor routine a bit down.
> // For week 5
>
> // A pipeline of transformers connected by bounded queues. Each
> // transformer consumes items from its input queue and produces items
> // on its output queue.
>
> // This is illustrated by generating URLs, fetching the corresponding
> // webpages, scanning the pages for links to other pages, and printing
> // those links; using four threads connected by three queues:
>
> // UrlProducer --(BlockingQueue<String>)-->
> // PageGetter --(BlockingQueue<Webpage>)-->
> // LinkScanner --(BlockingQueue<Link>)-->
> // LinkPrinter
>
If you're bound to using ExecutorService.newWorkStealingPool()
you might have better luck with a setup something like:
PageGetter
LinkScanner
... ...
UrlProducer -> ... ... -> LinkPrinter
... ...
PageGetter
LinkScanner
You'll still need to arrange for (un)expected termination.
Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Find similar | Unroll thread
WorkStealingPool H.L@operamail.com - 2015-10-05 12:42 -0700
Re: WorkStealingPool Jeff Higgins <jeff@invalid.invalid> - 2015-10-05 16:44 -0400
Re: WorkStealingPool Jeff Higgins <jeff@invalid.invalid> - 2015-10-06 15:55 -0400
Re: WorkStealingPool Jeff Higgins <jeff@invalid.invalid> - 2015-10-06 19:00 -0400
csiph-web