connector.setConnectTimeoutInMillis(250);

This satisfies both of you :) 
My 2 cents ^^
 
Cordialement, Regards,
-Edouard De Oliveira-
http://tedorg.free.fr/en/main.php

----- Message d'origine ----
De : Maarten Bosteels <[EMAIL PROTECTED]>
À : dev@mina.apache.org
Envoyé le : Mardi, 5 Février 2008, 10h25mn 01s
Objet : Re: connect timeout

On 
Feb 
5, 
2008 
10:04 
AM, 
Julien 
Vermillard 
<[EMAIL PROTECTED]> 
wrote:

> 
On 
Tue, 
5 
Feb 
2008 
09:53:27 
+0100
> 
"Maarten 
Bosteels" 
<[EMAIL PROTECTED]> 
wrote:
>
> 
> 
On 
Feb 
5, 
2008 
9:17 
AM, 
Julien 
Vermillard 
<[EMAIL PROTECTED]>
> 
> 
wrote:
> 
>
> 
> 
> 
On 
Mon, 
04 
Feb 
2008 
18:52:37 
-0700
> 
> 
> 
Jeff 
Genender 
<[EMAIL PROTECTED]> 
wrote:
> 
> 
>
> 
> 
> 
> 
great 
question..Im 
interested 
in 
this 
as 
well.
> 
> 
> 
>
> 
> 
> 
> 
Jeff
> 
> 
> 
>
> 
> 
> 
> 
Sangjin 
Lee 
wrote:
> 
> 
> 
> 
> 
I 
had 
a 
quick 
question 
on 
the 
connect 
timeout...
> 
> 
> 
> 
> 
The 
connect 
timeout 
supplied 
to 
connectors 
is 
in 
the 
unit 
of
> 
> 
> 
> 
> 
seconds, 
and 
it 
appears 
the 
minimum 
value 
you 
can 
use 
is 
1
> 
> 
> 
> 
> 
second 
( 
AbstractIoConnector.setConnectTimeout() 
in 
the 
case 
of
> 
> 
> 
> 
> 
the 
trunk). 
Is 
this 
by 
design?  
I 
can 
see 
cases 
where 
one 
needs
> 
> 
> 
> 
> 
to 
have 
a 
shorter 
connect 
timeout, 
but 
it 
seems 
it 
is 
not
> 
> 
> 
> 
> 
possible 
today. 
One 
solution 
might 
be 
to 
use
> 
> 
> 
> 
> 
ConnectFuture.join() 
with 
a 
timeout, 
but 
that 
works 
only 
if 
you
> 
> 
> 
> 
> 
want 
to 
block 
until 
it 
times 
out...
> 
> 
> 
> 
>
> 
> 
> 
> 
> 
It 
also 
seems 
that 
this 
minimum 
timeout 
value 
is 
somewhat 
tied
> 
> 
> 
> 
> 
to 
the 
timeout 
value 
used 
in 
the 
select() 
loop 
in 
the
> 
> 
> 
> 
> 
connector, 
which 
is 
hard 
coded 
to 
be 
1 
second.  
Would 
it 
be 
a
> 
> 
> 
> 
> 
good 
idea 
to 
support 
connect 
timeout 
values 
in 
milliseconds,
> 
> 
> 
> 
> 
and 
make 
it 
shorter 
than 
1 
second?
> 
> 
> 
> 
>
> 
> 
> 
> 
> 
Thanks,
> 
> 
> 
> 
> 
Sangjin
> 
> 
> 
> 
>
> 
> 
>
> 
> 
> 
Hi,
> 
> 
>
> 
> 
> 
Apparently 
it's 
doable, 
the 
timeout 
value 
is 
multiplicated 
by 
1000
> 
> 
> 
before 
being 
placed 
in 
the 
ConnectionRequest 
deadline.
> 
> 
> 
As 
far 
I 
understand 
it, 
it's 
not 
a 
big 
deal 
but 
an 
API 
change.
> 
>
> 
>
> 
> 
+1 
for 
sub-second 
timeout 
values
> 
> 
And 
I 
think 
it's 
best 
to 
change 
the 
API 
now, 
before 
cutting 
2.0-M1
> 
> 
How 
about 
adding 
a 
java.util.concurrent.TimeUnit 
parameter 
to
> 
> 
setConnectTimeout() 
?
> 
>
> 
> 
Maarten
> 
>
> 
>
> 
> 
>
> 
> 
> 
Julien
> 
> 
>
>
> 
I 
think 
specifying 
a 
millisecond 
param 
is 
enough, 
nobody 
will 
pass
> 
hour/day/month/picosecond 
based 
timeout 
values. 
It'll 
complexify 
the
> 
API 
for 
no 
much 
gain.
>

I 
agree 
that 
nobody 
will 
pass 
in 
hours 
or 
days, 
but 
IMHO  
it 
improves
readability 
a 
lot:

connector.setConnectTimeout(250, 
TimeUnit.MILLISECONDS);
or
connector.setConnectTimeout(250);

Especially 
when 
one 
is 
changing 
the 
API 
from 
seconds 
to 
millis, 
we 
should
try 
to 
make
it 
unambiguous 
and 
it's 
inline 
with 
a 
lot 
of 
the 
java.util.concurrent 
API.

Maarten

>
> 
Julien
>





      
_____________________________________________________________________________ 
Ne gardez plus qu'une seule adresse mail ! Copiez vos mails vers Yahoo! Mail 
http://mail.yahoo.fr

Reply via email to