@@ -0,0 +1,344 @@
+package ca.six.demo.lib.thread._volatile;%0A%0A/**%0A * Created by songzhw on 2017-02-13.%0A */%0Apublic class StopableThread extends Thread %7B%0A    private volatile boolean isRun;%0A%0A    public void setRun(boolean run) %7B%0A        isRun = run;%0A    %7D%0A%0A    @Override%0A    public void run() %7B%0A        while (isRun) %7B%0A            // do something%0A        %7D%0A    %7D%0A%7D%0A

stop a thread