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 17:48:08 UTC
[jira] [Created] (CURATOR-59) ConnectionState.CONNECTED can get set
incorrectly
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