Advertisement
Guest User

Untitled

a guest
Nov 22nd, 2010
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.06 KB | None | 0 0
  1. package de.fu.alp5.foreign.distributed;
  2.  
  3. import java.io.IOException;
  4. import java.rmi.AlreadyBoundException;
  5. import java.rmi.NotBoundException;
  6. import java.util.ArrayList;
  7. import java.util.List;
  8.  
  9. public class MainAnalyzer {
  10.  
  11.     public static void main(String[] args) throws IOException,
  12.             InterruptedException, AlreadyBoundException, NotBoundException {
  13.  
  14.         if (args.length < 3) {
  15.             System.out
  16.                     .println("Usage: -jar Foreign.jar <text file> <number of Threads> <host1> <host2> ...");
  17.         }
  18.  
  19.         int numberOfThreads = Integer.parseInt(args[1]);
  20.  
  21.         if (numberOfThreads != args.length - 2) {
  22.             System.err
  23.                     .println("There are more or less hosts then Threads to be spawned. Usage: number of hosts = number of threads");
  24.         }
  25.  
  26.         TextAnalyzerImpl textAnalyzer = new TextAnalyzerImpl(args[0],
  27.                 "woerter.txt", "words.txt");
  28.  
  29.         List<String> hostList = new ArrayList<String>();
  30.         for (int i = 0; i < args.length-2; ++i) {
  31.             hostList.add(args[i+2]);           
  32.         }
  33.        
  34.         textAnalyzer.analyze(numberOfThreads, hostList);
  35.         System.out.println(textAnalyzer);
  36.  
  37.     }
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement