Thanks for your reply!
You wrote: "your lock code to exit". Curator has the lock and not our code. How we told Curator to release the lock? If we call lock.acquire(1 * 1000, TimeUnit.MILLISECONDS), why it's get lock for a much longer time than 1 second?
Now we are trying changing the sessionTimeout and connectionTimeout:
CuratorFrameworkFactory.newClient(this.connectString, 1 * 1000, 1 * 1000, new RetryOneTime(1 * 1000));
With this, after the lock.acquire timeout, an exception is throw and the lock release ---> this is what we want!! But now we are dealing with the reconnect. After the server start again, Curator could not connect: "Connection timed out for connection string (hostxxx:2181) and timeout (1000) / elapsed (3608)". If we use a greater connection timeout, the release lock (our objective) takes more time.. It's strange that takes ~3608 seconds to connect.
Could you guide us?
Thanks and sorry for my english!!!
Demian