package com.concurrent.threadpool;

/**
 * @author shijingui on 2017/5/19
 */
public class PThread extends Thread {

    private ThreadPool threadPool;

    private Runnable target;
    private boolean isShutdown = false;
    private boolean isIdle = false;

    public PThread(Runnable target, String name, ThreadPool threadPool) {
        this.threadPool = threadPool;
        this.threadPool = threadPool;
        this.target = target;
    }
}

@@ -179,32 +179,41 @@
 et;%0A    private 
+volatile 
 boolean isShutdo
@@ -224,16 +224,16 @@
  false;%0A
-
     priv
@@ -335,16 +335,33 @@
 Pool) %7B%0A
+        super();%0A
         
@@ -408,60 +408,1006 @@
 is.t
-hreadPool = threadPool;%0A        this.target = target
+arget = target;%0A    %7D%0A%0A    public Runnable getTarget() %7B%0A        return target;%0A    %7D%0A%0A    public boolean isShutdown() %7B%0A        return isShutdown;%0A    %7D%0A%0A%0A    public boolean isIdle() %7B%0A        return isIdle;%0A    %7D%0A%0A    @Override%0A    public void run() %7B%0A%0A        while (!isShutdown) %7B%0A            isIdle = false;%0A            if (target != null) %7B%0A                target.run();%0A            %7D%0A            isIdle = true;%0A%0A%0A            try %7B%0A                threadPool.add(this);%0A                synchronized (this) %7B%0A                    wait();//thread is idle ,wait new thread%0A                %7D%0A            %7D catch (InterruptedException e) %7B%0A                e.printStackTrace();%0A            %7D%0A            isIdle = false;%0A        %7D%0A    %7D%0A%0A%0A    public synchronized void setTarget(Runnable target) %7B%0A        this.target = target;%0A        notifyAll();// set new task,notify run method,start execute this task%0A    %7D%0A%0A    public synchronized void shutdown() %7B%0A        isShutdown = true;%0A        notifyAll()
 ;%0A  

create thread pool