Ejemplo n.º 1
0
 /**
  * Terminate.
  *
  * <p>\u0040param filesProcessed Number of files processed. \u0040param processingTime Processing
  * time in seconds.
  */
 protected static void terminate(int filesProcessed, long processingTime) {
   System.out.println(
       "Processed "
           + Formatters.formatIntegerWithCommas(filesProcessed)
           + " files in "
           + Formatters.formatLongWithCommas(processingTime)
           + " seconds.");
 }
Ejemplo n.º 2
0
  /** Process files. */
  protected static int processFiles(String[] args) {
    int result = 0;
    //  Get file name/file wildcard specs.

    String[] wildCards = new String[args.length - INITPARAMS];

    for (int i = INITPARAMS; i < args.length; i++) {
      wildCards[i - INITPARAMS] = args[i];
    }
    //  Expand wildcards to list of
    //  file names.

    String[] fileNames = FileNameUtils.expandFileNameWildcards(wildCards);

    docsToProcess = fileNames.length;

    System.out.println(
        "There are "
            + Formatters.formatIntegerWithCommas(docsToProcess)
            + " documents to process.");
    //  Process each file.

    for (int i = 0; i < fileNames.length; i++) {
      processOneFile(fileNames[i]);
    }

    return fileNames.length;
  }
Ejemplo n.º 3
0
  protected Map sendRequest(DHTTransportContact target, Map data, int timeout) {
    try {
      byte[] res = sendRequest(target, formatters.bEncode(data), timeout);

      if (res == null) {

        return (null);
      }

      return (formatters.bDecode(res));

    } catch (Throwable e) {

      log(e);

      return (null);
    }
  }
Ejemplo n.º 4
0
  protected byte[] receiveRequest(DHTTransportUDPContact originator, byte[] data) {
    try {
      Map res = receiveRequest(originator, formatters.bDecode(data));

      if (res == null) {

        return (null);
      }

      return (formatters.bEncode(res));

    } catch (Throwable e) {

      log(e);

      return (null);
    }
  }
Ejemplo n.º 5
0
  protected boolean sendTunnelMessage(DHTTransportContact target, Map data) {
    try {
      return (sendTunnelMessage(target, formatters.bEncode(data)));

    } catch (Throwable e) {

      log(e);

      return (false);
    }
  }