You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@nutch.apache.org by Ilya Vishnevsky <Il...@e-legion.com> on 2007/05/21 10:42:20 UTC

bug in SegmentReader

It seems that there is bug in SegmentReader class.
It's in get() method.

Here is part of code:

    int cnt = 0;
    do {
      try {
        Thread.sleep(5000);
      } catch (Exception e) {};
      it = threads.iterator();
      while (it.hasNext()) {
        if (((Thread)it.next()).isAlive()) cnt++;
      }
      if ((cnt > 0) && (LOG.isDebugEnabled())) {
        LOG.debug("(" + cnt + " to retrieve)");
      }
    } while (cnt > 0);

Variable cnt can't decrease in the body of do-while loop, so as soon as
it once increases the loop becomes infinite. I think cnt must be
assigned to 0 at the beginning of the loop:

    do {
	int cnt = 0;
      try {
        Thread.sleep(5000);
etc...