Package org.menagerie

Examples of org.menagerie.BaseZkSessionManager


        Future<String> takeFuture = service.submit(new Callable<String>() {
            @Override
            public String call() throws Exception {
                ZooKeeper myZk = newZooKeeper();
                try{
                    ZkBlockingQueue<String> myQueue = new ZkBlockingQueue<String>(testPath, serializer, new BaseZkSessionManager(myZk), bound);
                    startLatch.await();

                    //this should block until the barrier is entered elsewhere
                    System.out.println(Thread.currentThread().getName()+": Taking an element off the queue...");
                    String queueEntry = myQueue.take();
View Full Code Here


            @Override
            public String call() throws Exception {
                ZooKeeper myZk = newZooKeeper();
                try{
                    @SuppressWarnings({"MismatchedQueryAndUpdateOfCollection"})
                    ZkBlockingQueue<String> myQueue = new ZkBlockingQueue<String>(testPath, serializer, new BaseZkSessionManager(myZk), bound);
                    startLatch.await();

                    //this should block until the barrier is entered elsewhere
                    System.out.println(Thread.currentThread().getName()+": Polling an element off the queue...");
                    String queueEntry = myQueue.poll(Long.MAX_VALUE,TimeUnit.DAYS);
View Full Code Here

        Future<Boolean> offerFuture = service.submit(new Callable<Boolean>() {
            @Override
            public Boolean call() throws Exception {
                ZooKeeper myZk = newZooKeeper();
                try{
                    ZkBlockingQueue<String> myQueue = new ZkBlockingQueue<String>(testPath, serializer, new BaseZkSessionManager(myZk), bound);
                    //this should block
                    return myQueue.offer("Test String",Long.MAX_VALUE,TimeUnit.DAYS);
                }finally{
                    myZk.close();
                }
View Full Code Here

        //be sure that the lock-place is created
        ZkUtils.recursiveSafeDelete(zk, baseLockPath, -1);
        zk.create(baseLockPath,new byte[]{}, ZooDefs.Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT);

        zkSessionManager = new BaseZkSessionManager(zk);
    }
View Full Code Here

                    If the read lock never acquires, then this method will block until the timeout
                    kills everything
                    */
                    ZooKeeper zooKeeper = TestUtils.newZooKeeper(hostString, timeout);
                    try{
                        ZkSessionManager zksm = new BaseZkSessionManager(zooKeeper);
                        ReadWriteLock rwLock = new ReentrantZkReadWriteLock2(baseLockPath,zksm);
                        Lock readLock = rwLock.readLock();
                        readLock.lock();
                        try{
                            return null;
View Full Code Here

                    If the read lock never acquires, then this method will block until the timeout
                    kills everything
                    */
                    ZooKeeper zooKeeper = TestUtils.newZooKeeper(hostString, timeout);
                    try{
                        ZkSessionManager zksm = new BaseZkSessionManager(zooKeeper);
                        ReadWriteLock rwLock = new ReentrantZkReadWriteLock2(baseLockPath,zksm);
                        Lock readLock = rwLock.readLock();
                        readLock.lock();
                        try{
                            return null;
View Full Code Here

TOP

Related Classes of org.menagerie.BaseZkSessionManager

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.