@Override
    @SuppressWarnings("unchecked")
    public <T extends Element> T getElementInstance(final Class<T> elementClass) {
        try {
            final ElementType elementType = new ElementType(elementClass);
            final Provider<Element> elementProvider = elementMap.get(elementType);
            if (elementProvider == null) {
                LOGGER.error("No element provider found for " + elementClass);
                throw new RuntimeException("No element provider found for " + elementClass);
            }
            return (T) elementProvider.get();
        } catch (final RuntimeException rex) {
            LOGGER.error("Failed to load {}", elementClass, rex);
            throw rex;
        }
    }
Implements an idiom to prevent double checked locking.
stroom-pipeline/src/main/java/stroom/pipeline/factory/ElementRegistryFactoryImpl.java