You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@curator.apache.org by Corey Nolet <cj...@gmail.com> on 2014/06/21 04:14:08 UTC
LeaderSelector throwing exception on mutex.acquire()
The exception below is happening quite frequently in my code. It looks like
it's because I'm trying to do operations with a client before it has fully
initiated a connection to Zookeeper. What is the recommended way to wait
until the curatorFramework is connected? Apply a connectionListener and
block until a state of CONNECTED is passed into the listener?
Thanks!
2014-06-20 22:10:08,335 [leader.LeaderSelector] ERROR: mutex.acquire()
threw an exception
java.lang.IllegalStateException: instance must be started before calling
this method
at com.google.common.base.Preconditions.checkState(Preconditions.java:149)
at
org.apache.curator.framework.imps.CuratorFrameworkImpl.delete(CuratorFrameworkImpl.java:358)
at
org.apache.curator.framework.recipes.locks.LockInternals.deleteOurPath(LockInternals.java:345)
at
org.apache.curator.framework.recipes.locks.LockInternals.internalLockLoop(LockInternals.java:335)
at
org.apache.curator.framework.recipes.locks.LockInternals.attemptLock(LockInternals.java:225)
at
org.apache.curator.framework.recipes.locks.InterProcessMutex.internalLock(InterProcessMutex.java:221)
at
org.apache.curator.framework.recipes.locks.InterProcessMutex.acquire(InterProcessMutex.java:77)
at
org.apache.curator.framework.recipes.leader.LeaderSelector.doWork(LeaderSelector.java:385)
at
org.apache.curator.framework.recipes.leader.LeaderSelector.doWorkLoop(LeaderSelector.java:443)
at
org.apache.curator.framework.recipes.leader.LeaderSelector.access$100(LeaderSelector.java:63)
at
org.apache.curator.framework.recipes.leader.LeaderSelector$2.call(LeaderSelector.java:244)
at
org.apache.curator.framework.recipes.leader.LeaderSelector$2.call(LeaderSelector.java:238)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
at java.util.concurrent.FutureTask.run(FutureTask.java:166)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
at java.util.concurrent.FutureTask.run(FutureTask.java:166)
at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:724)
Re: LeaderSelector throwing exception on mutex.acquire()
Posted by Jordan Zimmerman <jo...@jordanzimmerman.com>.
This error says that start() has not been called on the CuratorFramework instance. You should call start() immediately after allocating it.
-JZ
From: Corey Nolet cjnolet@gmail.com
Reply: user@curator.apache.org user@curator.apache.org
Date: June 20, 2014 at 9:14:37 PM
To: user user@curator.apache.org
Subject: LeaderSelector throwing exception on mutex.acquire()
The exception below is happening quite frequently in my code. It looks like it's because I'm trying to do operations with a client before it has fully initiated a connection to Zookeeper. What is the recommended way to wait until the curatorFramework is connected? Apply a connectionListener and block until a state of CONNECTED is passed into the listener?
Thanks!
2014-06-20 22:10:08,335 [leader.LeaderSelector] ERROR: mutex.acquire() threw an exception
java.lang.IllegalStateException: instance must be started before calling this method
at com.google.common.base.Preconditions.checkState(Preconditions.java:149)
at org.apache.curator.framework.imps.CuratorFrameworkImpl.delete(CuratorFrameworkImpl.java:358)
at org.apache.curator.framework.recipes.locks.LockInternals.deleteOurPath(LockInternals.java:345)
at org.apache.curator.framework.recipes.locks.LockInternals.internalLockLoop(LockInternals.java:335)
at org.apache.curator.framework.recipes.locks.LockInternals.attemptLock(LockInternals.java:225)
at org.apache.curator.framework.recipes.locks.InterProcessMutex.internalLock(InterProcessMutex.java:221)
at org.apache.curator.framework.recipes.locks.InterProcessMutex.acquire(InterProcessMutex.java:77)
at org.apache.curator.framework.recipes.leader.LeaderSelector.doWork(LeaderSelector.java:385)
at org.apache.curator.framework.recipes.leader.LeaderSelector.doWorkLoop(LeaderSelector.java:443)
at org.apache.curator.framework.recipes.leader.LeaderSelector.access$100(LeaderSelector.java:63)
at org.apache.curator.framework.recipes.leader.LeaderSelector$2.call(LeaderSelector.java:244)
at org.apache.curator.framework.recipes.leader.LeaderSelector$2.call(LeaderSelector.java:238)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
at java.util.concurrent.FutureTask.run(FutureTask.java:166)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
at java.util.concurrent.FutureTask.run(FutureTask.java:166)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:724)