class Main {

    public static void shutdown() {
        if (null != inUse && MAIN_CALLED.get()) {
            LOGGER.finest("Shutting down container from cdi.Main");
            // re-set the main called, so if somebody starts, shuts down and starts again, we correctly evaluate the
            // shutdown method
            MAIN_CALLED.set(false);
            inUse.shutdown();
        } else {
            // now we need to cover cases where the main method was not invoked
            try {
                ((SeContainer) CDI.current()).close();
            } catch (IllegalStateException e) {
                LOGGER.log(Level.FINEST, "Failed to obtain a CDI instance to shut down, probably duplicate call", e);
            }
        }
    }

    private  Main();

}