stackoverflow では、 の使用をよく見かけますThread.currentThread().isInterrupted()。while ループで実装Runnableして使用する場合は、次のようになります。
public void run() {
while(!Thread.currentThread().isInterrupted()) { ... }
}
使用に違いはありますか(使用時にフラグがクリアされることThread.interrupted()以外)?interruptedinterrupted()
私も見Thread.currentThread().interrupted()ました。それはそれを使用する正しい方法ですか、それともThread.interrupted()十分ですか?