package myBean;

public class TaskBean extends Thread {

	public TaskBean() {
	}
	
	private int percent = 0;
	private boolean complete = false;

	public synchronized void run() {
		while(true) {
			if(percent >= 100) {
				complete = true;
				return;
			}
			try {
				//繁重的任务，这里用让它睡1秒表示
				Thread.sleep(1000);
			} catch (Exception e) {
				System.err.println("TaskBean.run()" + e.getMessage());
			}
			
			percent += 10;
		}
	}
	
	public boolean isComplete() {
		return complete;
	}
	
	public int getPercent() {
		return percent;
	}
}