@Test public void testAdd() { ConcurrentPooledLinkedList<Integer> l = new ConcurrentPooledLinkedList<>(2000); l.iter(); CountDownLatch latch = new CountDownLatch(200); Thread[] addThread = createAndStartThreads(new Runnable() { @Override public void run() { latch.countDown(); try { latch.await(); } catch (InterruptedException e) { throw new RuntimeException(e); } for (int i = 0; i < 10; i++) { l.add(i); } } }, 100); Thread[] addFirstThread = createAndStartThreads(new Runnable() { @Override public void run() { latch.countDown(); try { latch.await(); } catch (InterruptedException e) { throw new RuntimeException(e); } for (int i = 0; i < 10; i++) { l.addFirst(i); } } }, 100); joinAll(addThread, addFirstThread); assertEquals(2000, l.size()); }
@Override public void add(T object) { lock.lockWrite(); super.add(object); lock.unlockWrite(); }
ConcurrentPooledLinkedList extends PooledLinkedList<T> implements ConcurrentCollection { @Override public void add(T object) { lock.lockWrite(); super.add(object); lock.unlockWrite(); } }
ConcurrentPooledLinkedList extends PooledLinkedList<T> implements ConcurrentCollection { @Override public void add(T object) { lock.lockWrite(); super.add(object); lock.unlockWrite(); } ConcurrentPooledLinkedList(int maxPoolSize); }
ConcurrentPooledLinkedList extends PooledLinkedList<T> implements ConcurrentCollection { @Override public void add(T object) { lock.lockWrite(); super.add(object); lock.unlockWrite(); } ConcurrentPooledLinkedList(int maxPoolSize); @Override void add(T object); @Override void addFirst(T object); @Override int size(); @Override void iter(); @Override void iterReverse(); @Override T next(); @Override T previous(); @Override void remove(); @Override T removeLast(); @Override void clear(); @Override ReadWriteLock getLock(); }
ConcurrentPooledLinkedList extends PooledLinkedList<T> implements ConcurrentCollection { @Override public void add(T object) { lock.lockWrite(); super.add(object); lock.unlockWrite(); } ConcurrentPooledLinkedList(int maxPoolSize); @Override void add(T object); @Override void addFirst(T object); @Override int size(); @Override void iter(); @Override void iterReverse(); @Override T next(); @Override T previous(); @Override void remove(); @Override T removeLast(); @Override void clear(); @Override ReadWriteLock getLock();  }