Package com.comcast.cqs.util

Examples of com.comcast.cqs.util.RandomNumberCollection


    }
  }

  @Test
  public void testRandomNumCol() throws Exception {
    RandomNumberCollection c = new RandomNumberCollection(10);
    Set<Integer> seen = new HashSet<Integer>();
    for(int i = 0; i < 10; i++) {
      int num = c.getNext();
      logger.info("got num=" + num);
      if (seen.contains(num)) {
        fail("returned " + num + " which was already returned");
      }
      seen.add(num);
    }

    c = new RandomNumberCollection(1);
    if (c.getNext() != 0) {
      fail("Expected 0");
    }
  }
View Full Code Here


        } else {
           
          // get from random set of rows
            // note: as a simplification we may return less messages than length if not all rows contain messages
           
          RandomNumberCollection rc = new RandomNumberCollection(numberPartitions);
            int numFound = 0;
           
            for (int i = 0; i < numberPartitions && numFound < length; i++) {
               
              int partition = rc.getNext();
                String key = queueHash + "_" + shard + "_" + partition;
               
                CmbColumnSlice<CmbComposite, String> columnSlice = cassandraHandler.readColumnSlice(
                    AbstractDurablePersistence.CQS_KEYSPACE, COLUMN_FAMILY_PARTITIONED_QUEUE_MESSAGES, key, null, null, 1,
                        CMB_SERIALIZER.STRING_SERIALIZER,
View Full Code Here

TOP

Related Classes of com.comcast.cqs.util.RandomNumberCollection

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.