Пример #1
0
 // write remaining links to db
 // unlock domains
 // synchronized?
 @Override
 public synchronized void finalize() {
   if (newLinks.size() != 0)
     try {
       // write the new links to the db
       flush();
       // write links that wern't used to db
       DBLink.getInstance().addNewLinks(links);
     } catch (SpiderDataException e) // there was a data error
     {
       Logger.log(2, e.getClazz(), e.getMeth(), e.getMessage());
     }
 }
Пример #2
0
  // thread safe method that returns if there are more links
  public synchronized boolean isEmpty() {
    if (links.size() == 0) {
      try {
        links = DBLink.getInstance().getLinksAndDelete(conf.getLinkRetrieveCount());
      } catch (SpiderDataException e) {
        Logger.log(1, e.getClazz(), e.getMeth(), e.getMessage());
      }
      // if still empty then there are no more links
      if (links.size() == 0) return true;
    }

    return false;
  }