Beispiel #1
0
  private void shutdown() {
    // shut down all threads
    try {

      for (Thread t : this.linkQueuerThreadPool) {
        if (t.isAlive()) {
          t.join(CrawlerConstants.THREAD_JOIN_WAIT_TIME);
        }
      }

      for (Thread t : this.matcherThreadPool) {
        if (t.isAlive()) {
          t.join(CrawlerConstants.THREAD_JOIN_WAIT_TIME);
        }
      }

      for (Thread t : this.linkExtractorPool) {
        if (t.isAlive()) {
          t.join(CrawlerConstants.THREAD_JOIN_WAIT_TIME);
        }
      }

      for (Thread t : this.getThreadPool) {
        if (t.isAlive()) {
          t.join(CrawlerConstants.THREAD_JOIN_WAIT_TIME);
        }
      }

      logger.info(CLASSNAME + ": All threads shut down");

      DBWrapper.shutdown();
      logger.info(CLASSNAME + ": Database has shut down");

    } catch (InterruptedException e) {
      e.printStackTrace();
    }
  }
Beispiel #2
0
  /** Initialise the database */
  private void initialiseDb() {

    EntityStore store = DBWrapper.setupDatabase(this.dbEnvDir, false);
    this.dao = new CrawlerDao(store);
    logger.info(CLASSNAME + " Database initialised");
  }