[ 
https://issues.apache.org/jira/browse/CASSANDRA-7885?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14123588#comment-14123588
 ] 

Pavel Yaskevich edited comment on CASSANDRA-7885 at 9/5/14 9:13 PM:
--------------------------------------------------------------------

Normally I would do it a bit differently because await\{Uninterruptibly\}() 
doesn't really indicate if operation was successful (and, in turn, if channel 
is valid) when waiting completes. Here is how I would do it (if there is no 
checked exception declared):

{noformat}
ChannelFuture bindFuture = bootstrap.bind(socket);
if (!bindFuture.awaitUninterruptibly().isSuccess())
    throw new IllegalStateException(String.format("Failed to bind port %d on 
%s.", port, host));

connectionTracker.allChannels.add(bindFuture.channel());
{noformat}



was (Author: xedin):
Normally I would do it a bit differently because await{Uninterruptibly}() 
doesn't really indicate if operation was successful (and, in turn, if channel 
is valid) when waiting completes. Here is how I would do it (if there is no 
checked exception declared):

{noformat}
ChannelFuture bindFuture = bootstrap.bind(socket);
if (!bindFuture.awaitUninterruptibly().isSuccess())
    throw new IllegalStateException(String.format("Failed to bind port %d on 
%s.", port, host));

connectionTracker.allChannels.add(bindFuture.channel());
{noformat}


> Make native Server start() method block until the server is properly bound
> --------------------------------------------------------------------------
>
>                 Key: CASSANDRA-7885
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-7885
>             Project: Cassandra
>          Issue Type: Bug
>            Reporter: Sylvain Lebresne
>            Assignee: Sylvain Lebresne
>            Priority: Minor
>             Fix For: 2.1.1
>
>         Attachments: 7885.txt
>
>
> The native Server {{start()}} method returns before making sure the bind 
> operation has succeeded, so the server might not be fully ready when it 
> returns. It's not a big deal but it's slightly unexpected and I think that 
> it's the cause of the [intermittent failures of DeleteTest on 
> jenkins|http://cassci.datastax.com/job/cassandra-2.1.0_utest/lastBuild/testReport/junit.framework/TestSuite/org_apache_cassandra_cql3_DeleteTest/].



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to