Package com.leansoft.bigqueue

Examples of com.leansoft.bigqueue.IBigQueue.peek()


    QueueResponse resp = new QueueResponse();
    byte[] data = null;
    IBigQueue bigQueue = queueMap.get(topic);
    if (bigQueue != null) {
      try {
        data = bigQueue.peek();
      } catch (IOException e) {
        resp.setResultCode(ResultCode.FAILURE);
        return resp;
      }
    }
View Full Code Here


      // ensure the new big queue is empty
      assertNotNull(bigQueue);
      assertTrue(bigQueue.size() == 0);
      assertTrue(bigQueue.isEmpty());
      assertNull(bigQueue.dequeue());
      assertNull(bigQueue.peek());
     
      // enqueue some items
      for(int i = 0; i < 10; i++) {
        String item = String.valueOf(i);
        bigQueue.enqueue(item.getBytes());
View Full Code Here

      // now the big queue is not empty
      assertTrue(!bigQueue.isEmpty());
      assertTrue(bigQueue.size() == 10);
     
      // peek the front of the queue
      assertEquals(String.valueOf(0), new String(bigQueue.peek()));
     
      // dequeue some items
      for(int i = 0; i < 5; i++) {
        String item = new String(bigQueue.dequeue());
        assertEquals(String.valueOf(i), item);
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.