You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@curator.apache.org by "Jordan Zimmerman (JIRA)" <ji...@apache.org> on 2013/09/26 19:56:09 UTC

[jira] [Resolved] (CURATOR-59) ConnectionState.CONNECTED can get set incorrectly

     [ https://issues.apache.org/jira/browse/CURATOR-59?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jordan Zimmerman resolved CURATOR-59.
-------------------------------------

    Resolution: Fixed

Fixed and pushed for next release
                
> ConnectionState.CONNECTED can get set incorrectly
> -------------------------------------------------
>
>                 Key: CURATOR-59
>                 URL: https://issues.apache.org/jira/browse/CURATOR-59
>             Project: Apache Curator
>          Issue Type: Bug
>          Components: Framework
>    Affects Versions: 2.2.0-incubating
>            Reporter: Jordan Zimmerman
>            Assignee: Jordan Zimmerman
>             Fix For: 2.3.0
>
>
> If the client is never able to connect to a server, it will incorrectly set ConnectionState.CONNECTED. 
> Example:
> {code}
>     @Test
>     public void testNeverConnected() throws Exception
>     {
>         PersistentEphemeralNode persistentEphemeralNode = null;
>         // use a connection string to a non-existent server
>         CuratorFramework client = CuratorFrameworkFactory.newClient("localhost:1111", 100, 100, new RetryOneTime(1));
>         try
>         {
>             final BlockingQueue<ConnectionState> queue = Queues.newLinkedBlockingQueue();
>             ConnectionStateListener listener = new ConnectionStateListener()
>             {
>                 @Override
>                 public void stateChanged(CuratorFramework client, ConnectionState state)
>                 {
>                     queue.add(state);
>                 }
>             };
>             client.getConnectionStateListenable().addListener(listener);
>             client.start();
>             // use a recipe that continuously retries
>             persistentEphemeralNode = new PersistentEphemeralNode(client, PersistentEphemeralNode.Mode.EPHEMERAL, "/abc/pen", "hello".getBytes());
>             persistentEphemeralNode.start();
>             Assert.assertEquals(queue.take(), ConnectionState.LOST);
>         }
>         finally
>         {
>             Closeables.closeQuietly(persistentEphemeralNode);
>             Closeables.closeQuietly(client);
>         }
>     }
> {code}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira