コード例 #1
0
  @Test
  @Ignore
  public void drainToWithEmptyDeque() {
    BlockingDeque<String> deque = new TransactionalLinkedList<String>();

    Collection<String> c = new LinkedList<String>();
    long version = stm.getTime();
    int result = deque.drainTo(c);
    assertEquals(0, result);

    assertEquals(version, stm.getTime());
    assertTrue(c.isEmpty());
    assertEquals(0, deque.size());
    testIncomplete();
  }
コード例 #2
0
  @Ignore
  @Test
  public void drainToWithNonEmptyDeque() {
    BlockingDeque<String> deque = new TransactionalLinkedList<String>();
    deque.add("1");
    deque.add("2");
    deque.add("3");

    Collection<String> c = new LinkedList<String>();
    long version = stm.getTime();
    int result = deque.drainTo(c);
    assertEquals(3, result);
    assertEquals(version + 1, stm.getTime());
    assertEquals("[1, 2, 3]", c.toString());
    assertEquals(0, deque.size());
    testIncomplete();
  }
コード例 #3
0
ファイル: Bpm200.java プロジェクト: emorency/onyx
 public List<BpmMessage> readAll() {
   List<BpmMessage> messages = new LinkedList<BpmMessage>();
   messageQueue.drainTo(messages);
   return Collections.unmodifiableList(messages);
 }