I read from a socket input stream like this
BufferedReader in = new BufferedReader(new InputStreamReader(socket.getInputStream())); String line; while((line = in.readLine()) != null){ // do something Thread.sleep(10); // for example 10ms }
Now the method of reading the input stream is blocked until the data is available.
In this case, thread cooling is a good idea? After 10 ms, it will still be blocked.
Please do not tell me about non-blocking IO, I know about it.
I'm just wondering if this helps the performance / processor anyway.
source share