Examples of sleepABit()


Examples of org.apache.curator.test.Timing.sleepABit()

                {
                    break;
                }
                timing.sleepABit();
            }
            timing.sleepABit();

            Assert.assertEquals(messages, Arrays.asList("1", "2", "3", "4", "5"));
        }
        finally
        {
View Full Code Here

Examples of org.apache.curator.test.Timing.sleepABit()

            Collection<InstanceSpec>    instances = cluster.getInstances();
            cluster.stop();

            Assert.assertTrue(timing.multiple(4).awaitLatch(lostLatch));
            timing.sleepABit();
            Assert.assertFalse(selector.hasLeadership());

            Assert.assertNotNull(lockNode.get());
           
            cluster = new TestingCluster(instances.toArray(new InstanceSpec[instances.size()]));
View Full Code Here

Examples of org.apache.curator.test.Timing.sleepABit()

            count1.start();
            count2.start();

            VersionedValue<Integer> versionedValue = count1.getVersionedValue();
            Assert.assertTrue(count1.trySetCount(versionedValue, 10));
            timing.sleepABit();
            versionedValue = count2.getVersionedValue();
            Assert.assertTrue(count2.trySetCount(versionedValue, 20));
            timing.sleepABit();

            VersionedValue<Integer> versionedValue1 = count1.getVersionedValue();
View Full Code Here

Examples of org.apache.curator.test.Timing.sleepABit()

            VersionedValue<Integer> versionedValue = count1.getVersionedValue();
            Assert.assertTrue(count1.trySetCount(versionedValue, 10));
            timing.sleepABit();
            versionedValue = count2.getVersionedValue();
            Assert.assertTrue(count2.trySetCount(versionedValue, 20));
            timing.sleepABit();

            VersionedValue<Integer> versionedValue1 = count1.getVersionedValue();
            VersionedValue<Integer> versionedValue2 = count2.getVersionedValue();
            Assert.assertTrue(count2.trySetCount(versionedValue2, 30));
            Assert.assertFalse(count1.trySetCount(versionedValue1, 40));
View Full Code Here

Examples of org.apache.curator.test.Timing.sleepABit()

            selector.start();

            Assert.assertTrue(timing.awaitLatch(debugLeadershipLatch));
            server.stop();
            Assert.assertTrue(timing.awaitLatch(lostLatch));
            timing.sleepABit();
            debugLeadershipWaitLatch.countDown();

            server = new TestingServer(server.getPort(), server.getTempDirectory());
            Assert.assertTrue(timing.awaitLatch(reconnectedLatch));
View Full Code Here

Examples of org.apache.curator.test.Timing.sleepABit()

                            {
                                @Override
                                public Object call() throws Exception
                                {
                                    latch.await();
                                    timing.sleepABit();
                                    client.create().withMode(CreateMode.PERSISTENT_SEQUENTIAL).inBackground(callback).forPath(path, bytes);
                                    return null;
                                }
                            }
                        );
View Full Code Here

Examples of org.apache.curator.test.Timing.sleepABit()

            Assert.assertTrue(timing.acquireSemaphore(semaphore, 1));

            KillSession.kill(client.getZookeeperClient().getZooKeeper(), server.getConnectString());

            Assert.assertTrue(timing.awaitLatch(interruptedLatch));
            timing.sleepABit();

            leaderSelector1.requeue();
            leaderSelector2.requeue();

            Assert.assertTrue(timing.acquireSemaphore(semaphore, 1));
View Full Code Here

Examples of org.apache.curator.test.Timing.sleepABit()

                LeaderSelector leaderSelector = new LeaderSelector(client, PATH_NAME, new LeaderSelectorListener()
                {
                    @Override
                    public void takeLeadership(CuratorFramework client) throws Exception
                    {
                        timing.sleepABit();
                        leaderList.add(ourIndex);
                    }

                    @Override
                    public void stateChanged(CuratorFramework client, ConnectionState newState)
View Full Code Here

Examples of org.apache.curator.test.Timing.sleepABit()

                {
                    Integer polledIndex = leaderList.poll(10, TimeUnit.SECONDS);
                    Assert.assertNotNull(polledIndex);
                    localLeaderList.add(polledIndex);
                }
                timing.sleepABit();
            }

            for ( LeaderSelector leaderSelector : selectors )
            {
                leaderSelector.close();
View Full Code Here

Examples of org.apache.curator.test.Timing.sleepABit()

                    {
                        @Override
                        public Object call() throws Exception
                        {
                            Assert.assertTrue(latch.await(timing.forWaiting().seconds(), TimeUnit.SECONDS));
                            timing.sleepABit(); // make sure second acquire is waiting
                            Assert.assertTrue(count.trySetCount(2));
                            return null;
                        }
                    }
                );
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.