class CacheServiceLoader {

    public static void initialise(final Properties properties) {
        if (null == properties) {
            LOGGER.warn("received null properties - exiting initialise method without creating service");
            return;
        }
        final String cacheClass = properties.getProperty(CacheProperties.CACHE_SERVICE_CLASS);

        if (null == cacheClass) {
            if (null == service) {
                LOGGER.debug("No cache service class was specified in properties.");
            }
            return;
        }
        try {
            service = Class.forName(cacheClass).asSubclass(ICacheService.class).newInstance();

        } catch (final InstantiationException | IllegalAccessException | ClassNotFoundException e) {
            throw new IllegalArgumentException("Failed to instantiate cache using class " + cacheClass, e);
        }

        service.initialise(properties);

        if (!shutdownHookAdded) {
            Runtime.getRuntime().addShutdownHook(new Thread(CacheServiceLoader::shutdown));
            shutdownHookAdded = true;
        }
    }

    private  CacheServiceLoader();

}