AbstractPlugin implements ReaderPlugin { @Override public final Map<String, SeReader> getReaders() { return readers; } protected  AbstractPlugin(String name); final String getName(); @Override final Map<String, SeReader> getReaders(); @Override final Set<String> getReaderNames(); @Override final SeReader getReader(String name); final void setParameters(Map<String, String> parameters);  }
@Test public void addRemoveReadersMultiThreaded() throws Exception { ReaderPlugin plugin = new BlankAbstractPlugin("addRemoveReadersMultiThreaded"); Map<String, SeReader> readers = plugin.getReaders(); final CountDownLatch lock = new CountDownLatch(10); addReaderThread(readers, 10, lock); addReaderThread(readers, 10, lock); removeReaderThread(readers, 10, lock); listReaders(readers, 10, lock); addReaderThread(readers, 10, lock); removeReaderThread(readers, 10, lock); listReaders(readers, 10, lock); removeReaderThread(readers, 10, lock); listReaders(readers, 10, lock); removeReaderThread(readers, 10, lock); lock.await(2, TimeUnit.SECONDS); Assert.assertEquals(0, lock.getCount()); }