@PreDestroy
    public void stopRepository() throws InterruptedException {
        LOGGER.info("Initiating shutdown of ModeShape");
        final String repoName = repository.getName();
        try {
            final Future<Boolean> futureUndeployRepo = modeShapeEngine.undeploy(repoName);
            if (futureUndeployRepo.get()) {
                LOGGER.info("ModeShape repository {} has undeployed.", repoName);
            } else {
                LOGGER.error("ModeShape repository {} undeploy failed without an exception, still deployed.", repoName);
            }
            LOGGER.info("Repository {} undeployed.", repoName);
        } catch (final NoSuchRepositoryException e) {
            LOGGER.error("Repository {} unknown, cannot undeploy.", repoName, e);
        } catch (final ExecutionException e) {
            LOGGER.error("Repository {} cannot undeploy.", repoName, e.getCause());
        }
        final Future<Boolean> futureShutdownEngine = modeShapeEngine.shutdown();
        try {
            if (futureShutdownEngine.get()) {
                LOGGER.info("ModeShape Engine has shutdown.");
            } else {
                LOGGER.error("ModeShape Engine shutdown failed without an exception, still running.");
            }
        } catch (final ExecutionException e) {
            LOGGER.error("ModeShape Engine shutdown failed.", e.getCause());
        }
    }
@ PreDestroy public void stopRepository ( ) throws InterruptedException { LOGGER . info ( "Initiating shutdown of ModeShape" ) ; final String repoName = repository . getName ( ) ; try { final Future < Boolean > futureUndeployRepo = modeShapeEngine . undeploy ( repoName ) ; if ( futureUndeployRepo . get ( ) ) { LOGGER . info ( "ModeShape repository {} has undeployed." , repoName ) ; } else { LOGGER . error ( "ModeShape repository {} undeploy failed without an exception, still deployed." , repoName ) ; } LOGGER . info ( "Repository {} undeployed." , repoName ) ; } catch ( final NoSuchRepositoryException e ) { LOGGER . error ( "Repository {} unknown, cannot undeploy." , repoName , e ) ; } catch ( final ExecutionException e ) { LOGGER . error ( "Repository {} cannot undeploy." , repoName , e . getCause ( ) ) ; } final Future < Boolean > futureShutdownEngine = modeShapeEngine . shutdown ( ) ; try { if ( futureShutdownEngine . get ( ) ) { LOGGER . info ( "ModeShape Engine has shutdown." ) ; } else { LOGGER . error ( "ModeShape Engine shutdown failed without an exception, still running." ) ; } } catch ( final ExecutionException e ) { LOGGER . error ( "ModeShape Engine shutdown failed." , e . getCause ( ) ) ; } }
Attempts to undeploy the repository and shutdown the ModeShape engine on
context destroy.

@throws InterruptedException if interrupted exception occurred