|
Re: JCiP Memoizer: msg#00027java.jsr.166-concurrency
On 10/17/06, Alexandru Popescu <the.mindstorm.mailinglist@xxxxxxxxx> wrote: > > I would start by saying that till now Chapter 5 is my favorite so far > :">. Still, I have a small problem (indeed it is 5am) understanding > the final version of Memoizer (page 108), or at least one line from > it: > > public V compute(final A arg) throws InterruptedException { > while(true) { > // code > } > } > It's because of this line further down: } catch (CancellationException e) { cache.remove(arg, f); from http://jcip.net/listings/Memoizer.java Here's a partial explanation: The memoizing compute method is trying to reflect the exception from the wrapped method back to the caller, but it also has to handle the case where the task may have been cancelled (somehow). In this case, the compute method removes its task from the cache (iff it created the task) and tries again. --Joe
|
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | JCiP Memoizer, Alexandru Popescu |
|---|---|
| Next by Date: | Re: JCiP Memoizer, Tim Peierls |
| Previous by Thread: | JCiP Memoizer, Alexandru Popescu |
| Next by Thread: | Re: JCiP Memoizer, Tim Peierls |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |