Comments (16)
Also, I'd be very interested to know how I can use an Executor for a PathChildrenCache.
from curator.
Additionally, it seems like that during the consumeMessage of the DistributedQueue, all other watchers are blocked and no other watch fires before that method has left.
from curator.
A quick glance suggests that the QueueConsumer/Executor mechanism is broken in DistributedQueue. I'll work on a fix for that and open a separate issue.
from curator.
Thanks Jordan!
from curator.
All the listeners in Curator are implemented using a ListenerContainer
. The addListener() method has two versions. The first takes only the listener instance. The second takes the listener instance and an Executor. So, if you want your listener to be called in a different thread:
ExecutorService executor = Executors.newSingleThreadExecutor(); // an example thread pool
cache.getListenable().addListener(myListener, myExecutor);
You don't have to use a thread pool for the Executor. Use whatever works for your app.
from curator.
I am curious to know how DistributedDoubleBarries can be correctly used in the same JVM.
Allocate a new DistributedDoubleBarrier instance for each thread that needs to be part of the barrier using the same barrierPath.
from curator.
Thanks Jordan. I think I have verified that when the thread waits for the DoubleBarrier in QueueConsumer, other watches in my app are blocked.
Do you think if I use a different CuratorFramework for each of my objects it could help resolving this problem?
from curator.
I see - so you have a QueueConsumer. When the consumer gets notified of a message it uses a DoubleBarrier. Can you write an example that exposes the problem?
from curator.
Sure. I'll work on an example project. It'll be a bit involved but I guess it's worth doing it to make sure that is actually the problem.
Also, for leader election, do I have to do a Thread.currentThread().join() at the end of takeLeadership() like you have done in the tests? It seems like the leadership is passed on to the next Participant if I don't do so.
from curator.
Sure. I'll work on an example project. It'll be a bit involved but I guess it's worth doing it to make sure that is actually the problem.
That will be necessary. I took a look at the code and see no reason why you should be getting the behavior your seeing. BTW - why are you using a Barrier?
from curator.
Also, for leader election, do I have to do a Thread.currentThread().join() at the end of takeLeadership() like you have done in the tests? It seems like the leadership is passed on to the next Participant if I don't do so.
takeLeadership() should only exit if you no longer want to be the leader. Thread.join() wouldn't be correct as you'd never exit.
from curator.
But that's what I want. I want to stay the leader unless my sever dies. What would be the alternative way?
from curator.
OK - then sure Thread.join().
from curator.
Oh! I found out what the issue was after trying to create the test case!
I was creating the PathChildrenCache for a non-existing node at the beginning. I was later creating the node that the Cache was watching on during the call for creating the first child. Somehow this wont trigger the watch on the path!
I think the PathChildrenCache should check for existence of the path and error out if it doesn't to prevent future confusion.
Thanks a lot! :)
from curator.
This is addressed by #34 and will be in the next release.
from curator.
Oh cool. Thanks Jordan for your help. I think I'm good to go for now :)
Amir
On Mar 6, 2012, at 2:19 PM, Jordan Zimmerman wrote:
This is addressed by #34 and will be in the next release.
Reply to this email directly or view it on GitHub:
#37 (comment)
from curator.
Related Issues (20)
- java.nio.channels.CancelledKeyException HOT 1
- java.lang.NoSuchMethodError: com.google.common.cache.CacheBuilder.build HOT 4
- adding nodes to zookeeper from local properties through archaius HOT 1
- InterProcessMutex is not releasing when called inside a future's onSuccess function. HOT 1
- Curator's Watch triggered two times for the same notification HOT 3
- Curator integration with Exhibitor-values to be provided for ExhibitorEnsembleProvider arguments HOT 1
- What's the plan for releasing changes to this? HOT 3
- org.apache.zookeeper.KeeperException$NodeExistsException: KeeperErrorCode = NodeExists HOT 3
- curator use this.client.create().creatingParentsIfNeeded().withMode(CreateMode.PERSISTENT).forPath(path, data); but I find zk didnot have this node. HOT 2
- Link in wiki is broken HOT 1
- Examples Link in Table of Contents leads to 404 HOT 2
- NoSuchMethodError exception HOT 2
- Curator connecting to a secured SASL zookeeper HOT 1
- Background operation retry gave up HOT 1
- ..
- The result of event.getPath() in BackgroundCallback confused me
- Missing method declaration addAuthInfo
- TestingServer cannot start, it always throw FailedServerStartException
- curator 5.3 connect docker zookeeper cluster
- the parent node never delete cause thousands of parent node
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from curator.