跳至主要内容

博文

目前显示的是 二月, 2019的博文

Interrupt Thread

Recently, I am handling the graceful shutdown of Syncer . In the process of implementation, I was surprised by some counterintuitive part of Java. Let’s go on and see whether you know it. Thread States The following enumerations are states of Java Thread which is cited from Java documentation: NEW A thread that has not yet started is in this state. RUNNABLE A thread executing in the Java virtual machine is in this state. BLOCKED A thread that is blocked waiting for a monitor lock is in this state. WAITING A thread that is waiting indefinitely for another thread to perform a particular action is in this state. TIMED_WAITING A thread that is waiting for another thread to perform an action for up to a specified waiting time is in this state. TERMINATED A thread that has exited is in this state. The naming of state is fine, but those description is not clear enough though: What a Thread 's state if it blocked in IO operation? What a Thread 's state if it calle