mahout-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ted Dunning <ted.dunn...@gmail.com>
Subject Re: Possible multi thread issue in AbstractDifferenceRecommenderEvaluator
Date Fri, 24 Sep 2010 06:43:25 GMT
I think not.  See
http://download.oracle.com/javase/6/docs/api/java/util/concurrent/ExecutorService.htmlfor
a definition of invokeAll.

By definition, invokeAll returns only when *all* tasks are done.  The only
reason for calling get is, as the comment says, in order to transplant
exceptions into the main calling threads stack so they will be delivered
coherently.  Unfortunately, the !isDone idiom prevents get from ever running
(because all tasks are already done).

Removing the if statement as you suggest in a later followup is the correct
thing to do.  There is no possible purpose for the if, even were it
inverted.

On Thu, Sep 23, 2010 at 11:15 PM, Sean Owen <srowen@gmail.com> wrote:

> The logic seems OK to me. invokeAll() kicks off all the Callables. It
> waits for all to finish on account of the calls to get(), which block
> until a result is ready. I think the isDone() call is redundant indeed
> but shouldn't hurt -- get() isn't called in the case that it's already
> done.
>
> Nevertheless I'll try to reproduce this.
>
> On Fri, Sep 24, 2010 at 1:50 AM, Stanley Ipkiss <saurabhnangia@gmail.com>
> wrote:
> >
> > For the class PreferenceEstimateCallable, the parent thread does not wait
> for
> > all the child threads of this class to complete. On just adding a few
> simple
> > log statements around the call() function (shown below), I have observed
> > that there were a lot more "Starting" (622 in number) as compared to
> > "Stopping" (1 in number) in my logfile. I ran it multiple times and
> > everytime I got some difference in the total number of logged start and
> > stop. I will try to fix this issue in my checked out code, but just
> wanted
> > to know if anyone else has noted this?
> >
> >   public Void call() throws TasteException {
> >      log.info("Starting - analysis for pref size:" + prefs.length());
> >      for (Preference realPref : prefs) {
> >        ....
> >      }
> >      log.info("Stopping - analysis for pref size:" + prefs.length());
> >      return null;
> >    }
> >
> > --
> > View this message in context:
> http://lucene.472066.n3.nabble.com/Possible-multi-thread-issue-in-AbstractDifferenceRecommenderEvaluator-tp1571411p1571411.html
> > Sent from the Mahout User List mailing list archive at Nabble.com.
> >
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message