| Author |
90% CPU -problem with thread in NIO
|
Dave Jones
Ranch Hand
Joined: Feb 20, 2005
Posts: 77
|
|
Hi Guys, I have a multi-threaded server written in non blocking NIO (one thread handles the IO) and after a while i see that it uses about 90% CPU. I managed to find the thread that causes the problem, and it is the one handling the IO but i need help understanding the reason for it, please take a look: Thanks I noticed that the problem only started after I got a null pointer exception in the line: connectingChannel.write... The thread has a while(true) loop surrounding a try...catch... that catches this exception and continues normally. The reason for the 90% CPU is that ioHandlerSelector.select(1000) returns immediately (after the exception), and it's surrounded by a while(true) loop (Every 1-3 ms i see a "no ready channels" msg) What can be the problem? Thanks again
|
 |
David Harkness
Ranch Hand
Joined: Aug 07, 2003
Posts: 1646
|
|
|
Don't you have to wait until the channel becomes writable (after connecting) to be able to write to it?
|
 |
 |
|
|
subject: 90% CPU -problem with thread in NIO
|
|
|