Certain methods in Java will block until they can do something, like ServerSocket.accept() and InputStream.read(), but how it does this is not easy for me to find. The closest thing I can think of is a while() loop with a Thread.sleep() each time through, but the longer the sleep period, the less responsive the blocking, and the shorter the sleep, the more spinning that occurs.
So, I guess I have one or two questions: 1. how do various standard functions (like the ones above) block? Native code? while() loops? Something else? and 2. How should I implement methods that block?