Package my.code.concurrency.c02.taskqueue.common

Examples of my.code.concurrency.c02.taskqueue.common.TestClient


    for (int i=0; i < NUMBER_OF_CLIENTS ; i++) {
      new Thread(new TestClient(taskManager, "Client"+i, MAX_CLENT_IDLE_TIME)).start();
    }

    // ..let the tread print on console..
    PrintStatus statusPrinter = new PrintStatus(taskManager, STATUS_PRINTER_INTERVAL);
    new Thread(statusPrinter).start();
  }
View Full Code Here


  /**
   * Workers call. Take a job from a job queue.
   */
  public Request take() {
    Request workItem = null;
    try {
      workItem = jobQueue.take();
    } catch (InterruptedException e) {
      Thread.currentThread().interrupt();
    }
View Full Code Here

  /**
   * Workers call. Take a job from a job queue.
   */
  public Request take() {
    Request workItem;
    synchronized (this) {
      // if queue is empty - wait
      while (jobQueue.isEmpty()) {
        try {
          this.wait();
View Full Code Here

  /**
   * @return status information about internal processing, queue length,
   */
  public synchronized TaskManagerStatus getStatus() {
    TaskManagerStatus result = new TaskManagerStatus();
    double[] progress = new double[workerList.size()];
    int i = 0;
    for (Worker worker : workerList) {
      progress[i] = worker.getProgress();
      i++;
View Full Code Here

  /**
   * @return status information about internal processing, queue length,
   */
  public synchronized TaskManagerStatus getStatus() {
    TaskManagerStatus result = new TaskManagerStatus();
    double[] progress = new double[workerList.size()];
    int i = 0;
    for (Worker worker : workerList) {
      progress[i] = worker.getProgress();
      i++;
View Full Code Here

    // instantiate Task Manager. TM handles its pool of workers.
    taskManager.start();

    // Initialise mock clients
    for (int i=0; i < NUMBER_OF_CLIENTS ; i++) {
      new Thread(new TestClient(taskManager, "Client"+i, MAX_CLENT_IDLE_TIME)).start();
    }

    // ..let the tread print on console..
    PrintStatus statusPrinter = new PrintStatus(taskManager, STATUS_PRINTER_INTERVAL);
    new Thread(statusPrinter).start();
View Full Code Here

  /**
   * Call workers to process requests from the TM queue
   */
  public void start() {
    for (int i = 0; i < numberOfWorkers; i++) {
      Worker worker = new Worker(this, i);
      workerList.add(worker);
      new Thread(worker).start();
    }
  }
View Full Code Here

  /**
   * Start workers
   */
  public void start() {
    for (int i = 0; i < numberOfWorkers; i++) {
      Worker worker = new Worker(this, i);
      workerList.add(worker);
      new Thread(worker).start();
    }
  }
View Full Code Here

TOP

Related Classes of my.code.concurrency.c02.taskqueue.common.TestClient

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.