[
https://issues.apache.org/jira/browse/CURATOR-100?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13958821#comment-13958821
]
zhangshuxing edited comment on CURATOR-100 at 4/3/14 1:49 PM:
--------------------------------------------------------------
Thank you for your reply. Let me give a example to simulate my question.
public static void main(String[] args) throws Exception {
CuratorFramework client = CuratorFrameworkFactory.builder()
.connectString("localhost:2181")
.retryPolicy(new ExponentialBackoffRetry(20,
100, 100))
.sessionTimeoutMs(60000).connectionTimeoutMs
(30000).build();
client.start();
Thread.sleep(3000);
client.close();
EnsurePath ensure = new EnsurePath("/bestree/test2");
ensure.ensure(client.getZookeeperClient());
Thread.currentThread().join();
}
The instance of CuratorFramework is already closed.But the EnsurePath still
takes effect and the path is created. So the close method of CuratorFramework
does not limit the generation of new zookeeper instance. In my use case,I have
a class control the lifetime of the CuratorFramework,but I can not achieve this
object.
was (Author: bestree007):
Thank you for your reply. Let me give a example to simulate my question.
public static void main(String[] args) throws Exception {
CuratorFramework client = CuratorFrameworkFactory.builder()
.connectString("localhost:2181")
.retryPolicy(new ExponentialBackoffRetry(20,
100, 100))
.sessionTimeoutMs(60000).connectionTimeoutMs(30000).build();
client.start();
Thread.sleep(3000);
client.close();
EnsurePath ensure = new EnsurePath("/bestree/test2");
ensure.ensure(client.getZookeeperClient());
Thread.currentThread().join();
}
The instance of CuratorFramework is already closed.But the EnsurePath still
takes effect and the path is created. So the close method of CuratorFramework
does not limit the generation of new zookeeper instance. In my use case,I have
a class control the lifetime of the CuratorFramework,but I can not achieve this
object.
> The close() method of CuratorFramework does not take effect when using
> EnsurePath
> ----------------------------------------------------------------------------------
>
> Key: CURATOR-100
> URL: https://issues.apache.org/jira/browse/CURATOR-100
> Project: Apache Curator
> Issue Type: Bug
> Components: Framework
> Affects Versions: 2.3.0
> Reporter: zhangshuxing
> Fix For: awaiting-response
>
>
> In my application,I use just one instance of CuratorFramework and expose it
> as a bean,so other bean can refer to it .I find when the close method of
> CuratorFramework is invoked,and then EnsurePath still try to get a new
> instance of ZooKeeper.I wonder whether it is a problem.
--
This message was sent by Atlassian JIRA
(v6.2#6252)