예제 #1
0
  public static void main(String[] args) {
    Connection connection = DBConnPool.getConnection();
    try {
      QuestionDao questionDao = new QuestionDao(connection); // 获取数据库中的所有问题,以此为入手点创建thread
      rawQuestionList = questionDao.getAllQuestions();
    } catch (Exception e) {
      e.printStackTrace();
    } finally {
      DBConnPool.closeConnection(connection);
    }

    if (rawQuestionList == null) return;

    for (int i = 0; i < THREAD_NUMBER; i++) {
      SORunner soRunner = new SORunner();
      Thread thread = new Thread(soRunner, "Dragon-" + i);
      thread.start();
    }
  }