Want more features on Pastebin? Sign Up, it's FREE!
Guest

Untitled

By: a guest on Nov 22nd, 2010  |  syntax: Java  |  size: 1.06 KB  |  views: 80  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  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. }
clone this paste RAW Paste Data