Stop/Interrupt threads blocked on waiting input from socket

后端 未结 6 1820
自闭症患者
自闭症患者 2021-01-04 04:12

As the title says I need a way to stop or interrupt a thread that is blocked waiting on an input from the socket.

6条回答
  •  时光取名叫无心
    2021-01-04 04:55

    Close the socket and the read will be unblocked (will exit with a subclass of IOException). Read reacting to Thread.interrupt is platform dependent (won't work on Solaris 10 for example).

提交回复
热议问题