Package net.mindlee.concurrent.activeobject

Source Code of net.mindlee.concurrent.activeobject.MakerClientThread

package net.mindlee.concurrent.activeobject;

import net.mindlee.concurrent.activeobject.ao.ActiveObject;
import net.mindlee.concurrent.activeobject.ao.Result;

public class MakerClientThread extends Thread {
  private final ActiveObject activeObject;
  private final char fillchar;

  public MakerClientThread(String name, ActiveObject activeObject) {
    super(name);
    this.activeObject = activeObject;
    this.fillchar = name.charAt(0);
  }

  public void run() {
    try {
      for (int i = 0; true; i++) {
        // û�д���ֵ�ĺ���
        Result result = activeObject.makeString(i, fillchar);
        Thread.sleep(10);
        String value = (String) result.getResultValue();
        System.out.println(Thread.currentThread().getName()
            + ": value = " + value);
      }
    } catch (InterruptedException e) {
    }
  }
}
TOP

Related Classes of net.mindlee.concurrent.activeobject.MakerClientThread

TOP
Copyright © 2018 www.massapi.com. 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.