Fwd: OP_CONNECT, connect, and finishConnect fail

Alan Bateman Alan.Bateman at oracle.com
Tue Sep 17 13:08:15 UTC 2013


On 17/09/2013 13:42, Johannes Rudolph wrote:
> :
>
> Of course, you could argue that registering for OP_CONNECT before 
> calling connect is a user error but is neither forbidden by the 
> documentation nor in any way prevented at runtime. All of the later 
> behavior of `finishConnect` makes no sense at all. Also the actual 
> call-sequence can usually be much more complicated in a common 
> multi-threaded setting so the actual calls registering the channel to 
> the selector and the connection attempt may be executed concurrently 
> for some reasons making this bug even harder to find.
>
This topic has been a discussed a number of times and we'd like to 
update the javadoc to make it clear how to use this API. I assume you 
don't have an issue when you register for OP_CONNECT after you have 
initiate the connect and after you have checked that it returned false 
(to indicate that the connection wasn't established immediately).

-Alan.


More information about the nio-dev mailing list