newbie - howto properly handle connect failures
"Trustin Lee (이희승)"
trustin at gmail.com
Thu Apr 29 05:32:45 EDT 2010
Hey, you know Korean. :)
lists at joerg-buchberger.de wrote:
> Anyonghaseyo Trustin.
>
> It works now - thanks!
> I've some followup questions, though:
>
> If the connectTimeoutMillis option is not used - is that the same as
> ChannelConfig.setConnectTimeoutMillis(0), which disables(?) timeout?
Set it to 0 to disable timeout. If it does not work, please let me
know. As a workaround, you could set it to a very large value.
> Why is it, that without the connectTimeoutMillis option, calls to
> future.awaitUninterruptibly() return almost immediately when host does not
> exist?
Either with or without connectTimeoutMillis,
future.awaitUninterruptible() will perhaps return almost immediately
when host does not exist (i.e. connection refused). If connection
attempt fails earlier than timeout, it will always fail fast because
there's no reason to wait more.
> Why would I want to use awaitUninterruptibly(long timeoutMillis),
> when I can (or should?!) set the connectTimeoutMillis option on the bootstrap
> anyway?
You could update UI (e.g. animation) for instance. ChannelFuture is not
only for connection attempts but for any I/O operations, so it should
have more use cases.
> Is there a summary of optional and required bootstrap options? (In my case,
> should I probaby look at ChannelConfig/SocketChannelConfig or is there
> additionally something more comprehensive?)
At the moment, you need to refer to the Javadoc of ChannelConfig and its
subtypes. I couldn't find a better way to maintain documentation
without making duplication. :)
> Cheers and kamsahamnida for this framework.
Danke schön :)
Trustin
> p.s. (and off-topic) ... about the korean characters in your mail address
> signature ... how would they read in english pronunciation? I Hyeu Seung?
Hee Seung :) That's my Korean name.
> "Trustin Lee (이희승)" <trustin at gmail.com> hat am 28. April 2010 um 08:40
> geschrieben:
>
>> This is incorrect. Connect timeout must be specified as a bootstrap option:
>>
>> bootstrap.setOption("child.connectTimeoutMillis", 60000);
>>
>> and you must make sure that the ChannelFuture returned by connect() is
>> complete. Otherwise, the future might return before the connection
>> attempt is finished completely.
>>
>> HTH,
>> Trustin
>>
>> Vijay K Pandey wrote:
>>> May be you should not wait Indefinitely on the client connect - have some
>>> time parameter - for eg 60 secs or so
>>>
>>> future.awaitUninterruptibly(60, TimeUnit.SECONDS);
>>>
>>> if (!future.isSuccess()) {
>>> bootstrap.releaseExternalResources();
>>> throw future.getCause();
>>> }
>>>
>>> I myself starting looking into Netty from yesterday - so I might be totally
>>> wrong :)
>>>
>>> Cheers
>>> Vijay
>> --
>> what we call human nature in actuality is human habit
>> http://gleamynode.net/
>>
>>
>
> _______________________________________________
> netty-users mailing list
> netty-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/netty-users
--
what we call human nature in actuality is human habit
http://gleamynode.net/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 260 bytes
Desc: OpenPGP digital signature
Url : http://lists.jboss.org/pipermail/netty-users/attachments/20100429/1b19baae/attachment-0001.bin
More information about the netty-users
mailing list