How a thread should close itself in Java?

Posted by Roman on Stack Overflow See other posts from Stack Overflow or by Roman
Published on 2010-03-22T10:57:32Z Indexed on 2010/03/22 11:01 UTC
Read the original article Hit count: 293

Filed under:
|
|
|

This is a short question. At some point my thread understand that it should suicide. What is the best way to do it:

  1. Thread.currentThread().interrupt();
  2. return;

By the way, why in the first case we need to use currentThread? Is Thread does not refer to the current thread?

© Stack Overflow or respective owner

Related posts about java

Related posts about thread