curator-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jordan Zimmerman (JIRA)" <j...@apache.org>
Subject [jira] [Created] (CURATOR-59) ConnectionState.CONNECTED can get set incorrectly
Date Thu, 26 Sep 2013 15:48:08 GMT
Jordan Zimmerman created CURATOR-59:
---------------------------------------

             Summary: 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

Mime
View raw message