Package org.apache.curator.retry

Examples of org.apache.curator.retry.RetryOneTime


        initCuratorFramework();
    }

    void initCuratorFramework()
    {
        client = CuratorFrameworkFactory.newClient(server.getConnectString(), timing.session(), timing.connection(), new RetryOneTime(1));
        client.start();
        client.getUnhandledErrorListenable().addListener(errorListener);
    }
View Full Code Here


    @Test
    public void     testLateAddition() throws Exception
    {
        Timing                          timing = new Timing();
        DistributedDelayQueue<Long>     queue = null;
        CuratorFramework                client = CuratorFrameworkFactory.newClient(server.getConnectString(), timing.session(), timing.connection(), new RetryOneTime(1));
        client.start();
        try
        {
            BlockingQueueConsumer<Long> consumer = new BlockingQueueConsumer<Long>(Mockito.mock(ConnectionStateListener.class));
            queue = QueueBuilder.builder(client, consumer, new LongSerializer(), "/test").buildDelayQueue();
View Full Code Here

    @Test
    public void     testBasic() throws Exception
    {
        Timing                          timing = new Timing();
        DistributedDelayQueue<Long>     queue = null;
        CuratorFramework                client = CuratorFrameworkFactory.newClient(server.getConnectString(), timing.session(), timing.connection(), new RetryOneTime(1));
        client.start();
        try
        {
            BlockingQueueConsumer<Long> consumer = new BlockingQueueConsumer<Long>(Mockito.mock(ConnectionStateListener.class));
            queue = QueueBuilder.builder(client, consumer, new LongSerializer(), "/test").buildDelayQueue();
View Full Code Here

    {
        final int QTY = 10;

        Timing                          timing = new Timing();
        DistributedDelayQueue<Long>     queue = null;
        CuratorFramework                client = CuratorFrameworkFactory.newClient(server.getConnectString(), timing.session(), timing.connection(), new RetryOneTime(1));
        client.start();
        try
        {
            BlockingQueueConsumer<Long> consumer = new BlockingQueueConsumer<Long>(Mockito.mock(ConnectionStateListener.class));
            queue = QueueBuilder.builder(client, consumer, new LongSerializer(), "/test").buildDelayQueue();
View Full Code Here

        final int QTY = 1000;

        Timing                          timing = new Timing();
        DistributedDelayQueue<Long>     putQueue = null;
        DistributedDelayQueue<Long>     getQueue = null;
        CuratorFramework                client = CuratorFrameworkFactory.newClient(server.getConnectString(), timing.session(), timing.connection(), new RetryOneTime(1));
        client.start();
        try
        {
            putQueue = QueueBuilder.builder(client, null, new LongSerializer(), "/test2").putInBackground(false).buildDelayQueue();
            putQueue.start();
View Full Code Here

        CuratorFramework    client = null;
        TestingCluster      cluster = new TestingCluster(3);
        cluster.start();
        try
        {
            client = CuratorFrameworkFactory.newClient(cluster.getConnectString(), timing.session(), timing.connection(), new RetryOneTime(1));
            client.start();

            final Semaphore             semaphore = new Semaphore(0);
            LeaderSelectorListener      listener = new LeaderSelectorListener()
            {
View Full Code Here

        CuratorFramework    client = null;
        TestingCluster      cluster = new TestingCluster(3);
        cluster.start();
        try
        {
            client = CuratorFrameworkFactory.newClient(cluster.getConnectString(), timing.session(), timing.connection(), new RetryOneTime(1));
            client.start();
            client.sync().forPath("/");

            final AtomicReference<Exception>        error = new AtomicReference<Exception>(null);
            final AtomicReference<String>           lockNode = new AtomicReference<String>(null);
View Full Code Here

    @Test
    public void    testBasic() throws Exception
    {
        ZooKeeper               client = mock(ZooKeeper.class, Mockito.RETURNS_MOCKS);
        CuratorZookeeperClient  curator = mock(CuratorZookeeperClient.class);
        RetryPolicy             retryPolicy = new RetryOneTime(1);
        RetryLoop               retryLoop = new RetryLoop(retryPolicy, null);
        when(curator.getZooKeeper()).thenReturn(client);
        when(curator.getRetryPolicy()).thenReturn(retryPolicy);
        when(curator.newRetryLoop()).thenReturn(retryLoop);
View Full Code Here

    @Test
    public void    testSimultaneous() throws Exception
    {
        ZooKeeper               client = mock(ZooKeeper.class, Mockito.RETURNS_MOCKS);
        RetryPolicy             retryPolicy = new RetryOneTime(1);
        RetryLoop               retryLoop = new RetryLoop(retryPolicy, null);
        final CuratorZookeeperClient  curator = mock(CuratorZookeeperClient.class);
        when(curator.getZooKeeper()).thenReturn(client);
        when(curator.getRetryPolicy()).thenReturn(retryPolicy);
        when(curator.newRetryLoop()).thenReturn(retryLoop);
View Full Code Here

                        {
                            @Override
                            public List<Integer> call() throws Exception
                            {
                                final List<Integer> countList = Lists.newArrayList();
                                CuratorFramework client = CuratorFrameworkFactory.newClient(server.getConnectString(), new RetryOneTime(1));
                                clients.add(client);
                                client.start();

                                SharedCount count = new SharedCount(client, "/count", 10);
                                counts.add(count);

                                final CountDownLatch latch = new CountDownLatch(1);
                                count.addListener
                                    (
                                        new SharedCountListener()
                                        {
                                            @Override
                                            public void countHasChanged(SharedCountReader sharedCount, int newCount) throws Exception
                                            {
                                                if ( newCount < 0 )
                                                {
                                                    latch.countDown();
                                                }
                                                else
                                                {
                                                    countList.add(newCount);
                                                }

                                                semaphore.release();
                                            }

                                            @Override
                                            public void stateChanged(CuratorFramework client, ConnectionState newState)
                                            {
                                            }
                                        }
                                    );
                                count.start();
                                startLatch.countDown();
                                latch.await();
                                return countList;
                            }
                        }
                    );
                futures.add(future);
            }

            CuratorFramework client = CuratorFrameworkFactory.newClient(server.getConnectString(), new RetryOneTime(1));
            clients.add(client);
            client.start();

            Assert.assertTrue(startLatch.await(10, TimeUnit.SECONDS));
View Full Code Here

TOP

Related Classes of org.apache.curator.retry.RetryOneTime

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.