Examples of seconds()


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

            queue.put(1L, System.currentTimeMillis() + Integer.MAX_VALUE)// never come out
            Long        value = consumer.take(1, TimeUnit.SECONDS);
            Assert.assertNull(value);

            queue.put(2L, System.currentTimeMillis());
            value = consumer.take(timing.seconds(), TimeUnit.SECONDS);
            Assert.assertEquals(value, Long.valueOf(2));

            value = consumer.take(1, TimeUnit.SECONDS);
            Assert.assertNull(value);
        }
View Full Code Here

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

                    new Callable<Object>()
                    {
                        @Override
                        public Object call() throws Exception
                        {
                            Lease lease = semaphore.acquire(timing.seconds(), TimeUnit.SECONDS);
                            Assert.assertNotNull(lease);
                            latch.countDown();
                            lease = semaphore.acquire(timing.forWaiting().seconds(), TimeUnit.SECONDS);
                            Assert.assertNotNull(lease);
                            return null;
View Full Code Here

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

            queue.put(1L, System.currentTimeMillis() + Integer.MAX_VALUE)// never come out
            Long        value = consumer.take(1, TimeUnit.SECONDS);
            Assert.assertNull(value);

            queue.put(2L, System.currentTimeMillis());
            value = consumer.take(timing.seconds(), TimeUnit.SECONDS);
            Assert.assertEquals(value, Long.valueOf(2));

            value = consumer.take(1, TimeUnit.SECONDS);
            Assert.assertNull(value);
        }
View Full Code Here

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

            for ( int i = 0; i < 10; ++i )
            {
                queue.put(i, 10);
            }

            Assert.assertEquals(blockingQueue.poll(timing.seconds(), TimeUnit.SECONDS), new Integer(0));
            timing.sleepABit();
            queue.put(1000, 1); // lower priority
            timing.sleepABit();
            Assert.assertEquals(blockingQueue.poll(timing.seconds(), TimeUnit.SECONDS), new Integer(1)); // is in consumer already
            Assert.assertEquals(blockingQueue.poll(timing.seconds(), TimeUnit.SECONDS), new Integer(1000));
View Full Code Here

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

            Assert.assertEquals(blockingQueue.poll(timing.seconds(), TimeUnit.SECONDS), new Integer(0));
            timing.sleepABit();
            queue.put(1000, 1); // lower priority
            timing.sleepABit();
            Assert.assertEquals(blockingQueue.poll(timing.seconds(), TimeUnit.SECONDS), new Integer(1)); // is in consumer already
            Assert.assertEquals(blockingQueue.poll(timing.seconds(), TimeUnit.SECONDS), new Integer(1000));
        }
        finally
        {
            Closeables.closeQuietly(queue);
View Full Code Here

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

            Assert.assertEquals(blockingQueue.poll(timing.seconds(), TimeUnit.SECONDS), new Integer(0));
            timing.sleepABit();
            queue.put(1000, 1); // lower priority
            timing.sleepABit();
            Assert.assertEquals(blockingQueue.poll(timing.seconds(), TimeUnit.SECONDS), new Integer(1)); // is in consumer already
            Assert.assertEquals(blockingQueue.poll(timing.seconds(), TimeUnit.SECONDS), new Integer(1000));
        }
        finally
        {
            Closeables.closeQuietly(queue);
            Closeables.closeQuietly(client);
View Full Code Here

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

            queue.put(1L, System.currentTimeMillis() + Integer.MAX_VALUE)// never come out
            Long        value = consumer.take(1, TimeUnit.SECONDS);
            Assert.assertNull(value);

            queue.put(2L, System.currentTimeMillis());
            value = consumer.take(timing.seconds(), TimeUnit.SECONDS);
            Assert.assertEquals(value, Long.valueOf(2));

            value = consumer.take(1, TimeUnit.SECONDS);
            Assert.assertNull(value);
        }
View Full Code Here

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

                        try
                        {
                            client.start();
                            DistributedDoubleBarrier        barrier = new DistributedDoubleBarrier(client, "/barrier", QTY);

                            Assert.assertTrue(barrier.enter(timing.seconds(), TimeUnit.SECONDS));

                            synchronized(TestDistributedDoubleBarrier.this)
                            {
                                int     thisCount = count.incrementAndGet();
                                if ( thisCount > max.get() )
View Full Code Here

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

                            postEnterLatch.countDown();
                            Assert.assertTrue(timing.awaitLatch(postEnterLatch));

                            Assert.assertEquals(count.get(), QTY);

                            Assert.assertTrue(barrier.leave(timing.seconds(), TimeUnit.SECONDS));
                            count.decrementAndGet();

                            postLeaveLatch.countDown();
                            Assert.assertTrue(timing.awaitLatch(postEnterLatch));
                        }
View Full Code Here

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

                                    semaphore.release();
                                    Assert.assertTrue(timing.awaitLatch(latch));
                                    return super.getChildrenForEntering();
                                }
                            };
                            Assert.assertTrue(barrier.enter(timing.seconds(), TimeUnit.SECONDS));
                            Assert.assertTrue(barrier.leave(timing.seconds(), TimeUnit.SECONDS));
                            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.