@Override
    public void close() throws IOException {
        try {
            queue.offer(IdStatusPair.END_SEMAPHORE, 60, TimeUnit.SECONDS);
        } catch (InterruptedException e) {
            return;
        }

        try {
            reportWorkerFuture.get(60, TimeUnit.SECONDS);
        } catch (ExecutionException e) {
            LOG.error("problem closing", e);
            throw new RuntimeException(e);
        } catch (TimeoutException e) {
            LOG.error("timeout closing", e);
        } catch (InterruptedException e) {
            //
        } finally {
            reportWorkerFuture.cancel(true);
        }
    }
@Test
    public void testExcludes(@TempDir Path tmpDir) throws Exception {
        Files.createDirectories(tmpDir.resolve("db"));
        Path dbDir = tmpDir.resolve("db/h2");
        Path config = tmpDir.resolve("tika-config.xml");
        String connectionString = "jdbc:h2:file:" + dbDir.toAbsolutePath();

        writeConfig("/configs/tika-config-excludes.xml",
                connectionString, config);
        AsyncConfig asyncConfig = AsyncConfig.load(config);
        PipesReporter reporter = asyncConfig.getPipesReporter();
        int numThreads = 10;
        int numIterations = 200;

        Map<PipesResult.STATUS, Long> expected = runBatch(reporter, numThreads, numIterations);
        reporter.close();
        Map<PipesResult.STATUS, Long> total = countReported(connectionString);
        assertEquals(16, total.size());
        long sum = 0;
        for (Map.Entry<PipesResult.STATUS, Long> e : expected.entrySet()) {
            if (e.getKey() != PARSE_SUCCESS && e.getKey() != PARSE_SUCCESS_WITH_EXCEPTION) {
                assertTrue(total.containsKey(e.getKey()), e.getKey().toString());
                assertEquals(e.getValue(), total.get(e.getKey()), e.getKey().toString());
            } else {
                assertFalse(total.containsKey(e.getKey()), e.getKey().toString());
            }
            sum += e.getValue();
        }
        assertEquals(numThreads * numIterations, sum);
    }