public void interrupt() {        if (this != Thread.currentThread())            checkAccess();        synchronized (blockerLock) {            Interruptible b = blocker;            if (b != null) {                interrupt0();           // Just to set the interrupt flag                b.interrupt(this);                return;            }        }        interrupt0();    }

intertupt办法的外围在于interrupt0()办法,这个办法只会将interruptFlag设置为true,尽管设置flag为true了,然而并不会中断以后线程,只有在线程运行能产生InterrupteException的办法时,jvm会主动中断线程并将线程的中断标记位革除,从新设置位false。

 public static boolean interrupted() {        return currentThread().isInterrupted(true);    }

interrupted办法次要是获取以后线程currentThread,并通过以后线程调用isInterrupted(true),参数true示意线程调用该办法之后会将中断标记位清零,从新设置为false

 public boolean isInterrupted() {        return isInterrupted(false);    }    private native boolean isInterrupted(boolean ClearInterrupted);

isInterrupted()办法底层时调用的java的本地办法isInterrupted(boolean ClearInterrupted),参数ClearInterrupted默认是false,阐明间接调用isInterrupted()是不会从新将标记地位为false,而且isInterrupted()是将调用该办法的对象所在线程的中断标记位设置为fasle
以后线程和调用线程不肯定雷同,比方以后线程是A,在A中调用线程B对象的isInterrupted()办法