This content has been marked as final. Show 4 replies
You are probably doing a concurrent select() in another thread. Try selector.wakeup() before the register, and make sure your select loop copes correctly with zero selected keys.
I tried to add a wakeup right before:
it didn't work.
I have a GUI which allows me to connect to a server by pushing a button, as soon as I push, the button stays in press state and it blocks at the line SocketChannel.register (I remind that the first connection works fine)
Can you post your select loop? And is it indeed running in a separate thread from the register()?1 person found this helpful
I had to add a lock, because if I wakeup and then register, it's still possible for the selecting thread to select()