Exemple #1
0
  private static void TestE(String host, int NUM)
      throws IOException, InterruptedException, ExecutionException {
    ArrayList<String> list = new ArrayList<String>();
    String host1 = host + ":9001";
    list.add(host1);
    // String host2 = host + ":9002";
    // list.add(host2);
    // String host3 = host + ":9003";
    // list.add(host3);
    long start = System.currentTimeMillis();
    BeanstalkClient client = new BeanstalkClient(list);
    System.out.println("init time : " + (System.currentTimeMillis() - start));

    start = System.currentTimeMillis();
    client.watch(tubename);
    System.out.println("watch time : " + (System.currentTimeMillis() - start));

    start = System.currentTimeMillis();
    for (int i = 0; i < NUM; i++) {
      client.asynreserve();
    }
    // System.out.println("send time : "
    // + (System.currentTimeMillis() - start));

    // BlockingQueue<com.github.elloray.beanstalkR.Job> jobs
    // =client.getJobs();

    // start = System.currentTimeMillis();
    client.getJobs(NUM);
    client.stop();
    // System.out.println(new String(client.getJobs().take().getData()));
    System.out.println("consume time : " + (System.currentTimeMillis() - start));
  }
Exemple #2
0
  private static void TestD(String host, int NUM)
      throws IOException, InterruptedException, ExecutionException {
    ArrayList<String> list = new ArrayList<String>();
    String host1 = host + ":9001";
    list.add(host1);
    // String host2 = host + ":9002";
    // list.add(host2);
    // String host3 = host + ":9003";
    // list.add(host3);
    long start = System.currentTimeMillis();
    BeanstalkClient client = new BeanstalkClient(list);
    System.out.println("init time : " + (System.currentTimeMillis() - start));

    start = System.currentTimeMillis();
    client.watch(tubename);
    System.out.println("watch time : " + (System.currentTimeMillis() - start));

    start = System.currentTimeMillis();
    for (int i = 0; i < NUM; i++) {
      com.github.elloray.beanstalkR.util.Job job = client.reserve();
      // System.out.println(new String(job.getData()));
      // client.stat(host2);
    }
    System.out.println("consume time : " + (System.currentTimeMillis() - start));
    client.stop();
  }