public static LinkExtractorParser getParser(String parserClassName)
            throws LinkExtractorParseException {

        // Is there a cached parser?
        LinkExtractorParser parser = PARSERS.get(parserClassName);
        if (parser != null) {
            LOG.debug("Fetched {}", parserClassName);
            return parser;
        }

        try {
            Object clazz = Class.forName(parserClassName).getDeclaredConstructor().newInstance();
            if (clazz instanceof LinkExtractorParser) {
                parser = (LinkExtractorParser) clazz;
            } else {
                throw new LinkExtractorParseException(new ClassCastException(parserClassName));
            }
        } catch (IllegalArgumentException | ReflectiveOperationException | SecurityException e) {
            throw new LinkExtractorParseException(e);
        }
        LOG.info("Created {}", parserClassName);
        if (parser.isReusable()) {
            LinkExtractorParser currentParser = PARSERS.putIfAbsent(
                    parserClassName, parser);// cache the parser if not already
                                             // done by another thread
            if (currentParser != null) {
                return currentParser;
            }
        }

        return parser;
    }
@Test
    public void testReusableCache() throws Exception {
        assertSame(BaseParser.getParser(ReusableParser.class.getCanonicalName()), BaseParser.getParser(ReusableParser.class.getCanonicalName()));
    }