SegmentWriteQueue implements Closeable { @Override public void close() throws IOException { shutdown = true; try { executor.shutdown(); if (!executor.awaitTermination(1, TimeUnit.MINUTES)) { throw new IOException("The write wasn't able to shut down clearly"); } } catch (InterruptedException e) { throw new IOException(e); } } SegmentWriteQueue(SegmentConsumer writer);   SegmentWriteQueue(SegmentConsumer writer, int queueSize, int threadNo); void addToQueue(RemoteSegmentArchiveEntry indexEntry, byte[] data, int offset, int size); void flush(); SegmentWriteAction read(UUID id); @Override void close(); boolean isEmpty(); static final int THREADS; }
@Test(expected = IllegalStateException.class) public void testClose() throws IOException, InterruptedException { queue = new SegmentWriteQueue((tarEntry, data, offset, size) -> {}); queue.close(); queue.addToQueue(tarEntry(10), EMPTY_DATA, 0, 0); }