I have a thread that is blocked in a UDP packet, and I need to tell him to forget about this packet and do something else before the receive timeout occurs. Is there any way to do this?
Use the DatagramChannel to read your UDP packets and interrupt the reading stream. According to the documentation of Thread.interrupt (and the DatagramChannel), the read operation then throws a ClosedByInterruptException.
JB . NIO, AFAIK /. - TCP, . , . NIO .
- , , - . (n-1) Thread.isInterrupted().