Exemplo n.º 1
0
 public static void main(String[] args) throws InterruptedException {
   MyThread th1 = new MyThread();
   MyThread th2 = new MyThread();
   th1.setName("1");
   th2.setName("2");
   th1.start();
   th2.start();
   th1.join();
   th2.join();
   System.out.println(sb.toString());
 }
Exemplo n.º 2
0
 private void startThread() {
   if (thread == null) {
     thread = new MyThread();
     thread.setName(threadName);
     thread.setDaemon(true);
     thread.timer = this;
     thread.start();
   }
 }
Exemplo n.º 3
0
  public static void StartUnloadingParallel(int SessNo)
      throws IOException, InterruptedException, SQLException {
    System.out.println(
        (new StringBuilder("Unloading Files for Session - "))
            .append(SessNo)
            .append(" is Started")
            .toString());
    for (int i = 0; i < totalvalues; i++) {
      int val = i + 1;
      writer =
          new FileWriterWithEncoding(
              new File((String) filename.get(i)), Charset.forName((String) characterset.get(i)));
      mt =
          new MyThread(
              (new StringBuilder("Unload")).append(SessNo).append(val).toString(),
              writer,
              (ResultSet) rs.get(i),
              val,
              (String) fetchsize.get(i),
              (String) rowsep.get(i),
              (String) delim.get(i),
              (String) header.get(i),
              (String) filename.get(i));
      mt.setName((new StringBuilder("Unload")).append(SessNo).append(val).toString());
      mt.start();
      while (checkThreads.check_unload_completion(
              (new StringBuilder("Unload")).append(SessNo).toString(), "N")
          > 3) ;
    }

    checkThreads.check_unload_completion(
        (new StringBuilder("Unload")).append(SessNo).toString(), "Y");
    System.out.println(
        (new StringBuilder("Unloading Files for Session - "))
            .append(SessNo)
            .append(" is Completed")
            .toString());
    System.out.println("Process Completed");
    stmt.close();
    filename = new ArrayList();
    delim = new ArrayList();
    rowsep = new ArrayList();
    characterset = new ArrayList();
    fetchsize = new ArrayList();
    header = new ArrayList();
    rs = new ArrayList();
  }