Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如标题所示,当 socket io.read() 无法获取任何数据时,java 线程的状态是什么。很多文章提到io会被阻塞,但是jdk说阻塞发生在getting lock monitor? 怎么理解?
如果线程在等待I/O,我的理解是它处于RUNNABLE状态。BLOCKED当它尝试在被另一个线程锁定的对象上同步时,它会进入该状态。它在WAITING调用wait()(或其他几个方法)时处于状态。
RUNNABLE
BLOCKED
WAITING
wait()