ThreadEx.interrupt

Interrupts this thread.

<p> Unless the current thread is interrupting itself, which is always permitted, the {@link #checkAccess() checkAccess} method of this thread is invoked, which may cause a {@link SecurityException} to be thrown.

<p> If this thread is blocked in an invocation of the {@link Object#wait() wait()}, {@link Object#wait(long) wait(long)}, or {@link Object#wait(long, int) wait(long, int)} methods of the {@link Object} class, or of the {@link #join()}, {@link #join(long)}, {@link #join(long, int)}, {@link #sleep(long)}, or {@link #sleep(long, int)}, methods of this class, then its interrupt status will be cleared and it will receive an {@link InterruptedException}.

<p> If this thread is blocked in an I/O operation upon an {@link java.nio.channels.InterruptibleChannel InterruptibleChannel} then the channel will be closed, the thread's interrupt status will be set, and the thread will receive a {@link java.nio.channels.ClosedByInterruptException}.

<p> If this thread is blocked in a {@link java.nio.channels.Selector} then the thread's interrupt status will be set and it will return immediately from the selection operation, possibly with a non-zero value, just as if the selector's {@link java.nio.channels.Selector#wakeup wakeup} method were invoked.

<p> If none of the previous conditions hold then this thread's interrupt status will be set. </p>

<p> Interrupting a thread that is not alive need not have any effect.

@throws SecurityException if the current thread cannot modify this thread

@revised 6.0 @spec JSR-51

class ThreadEx
void
interrupt
()

Meta