@Test public void testRemove() { ConcurrentPooledLinkedList<Integer> l = new ConcurrentPooledLinkedList<>(10000); for (int i = 0; i < 10000; i++) { l.addFirst(i); } l.iter(); CountDownLatch latch = new CountDownLatch(1000); Thread[] removeThread = 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.lock.lockWrite(); l.next(); l.remove(); l.lock.unlockWrite(); } } }, 500); Thread[] removeLastThread = 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.removeLast(); } } }, 500); joinAll(removeThread, removeLastThread); assertEquals(0, l.size()); }
@Override public void remove() { lock.lockWrite(); super.remove(); lock.unlockWrite(); }
ConcurrentPooledLinkedList extends PooledLinkedList<T> implements ConcurrentCollection { @Override public void remove() { lock.lockWrite(); super.remove(); lock.unlockWrite(); } }
ConcurrentPooledLinkedList extends PooledLinkedList<T> implements ConcurrentCollection { @Override public void remove() { lock.lockWrite(); super.remove(); lock.unlockWrite(); } ConcurrentPooledLinkedList(int maxPoolSize); }
ConcurrentPooledLinkedList extends PooledLinkedList<T> implements ConcurrentCollection { @Override public void remove() { lock.lockWrite(); super.remove(); 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 remove() { lock.lockWrite(); super.remove(); 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();  }