public boolean execute(InstallContext context) { for (Hook hook : hooks.values()) { try { hook.getHook().execute(context); } catch (PackageException e) { // abort processing only for prepare and installed phase if (context.getPhase() == InstallContext.Phase.PREPARE || context.getPhase() == InstallContext.Phase.INSTALLED) { log.warn("Hook " + hook.name +" threw package exception. {} aborted.", context.getPhase(), e); return false; } log.warn("Hook " + hook.name +" threw package exception. Ignored", e); } catch (Throwable e) { log.warn("Hook " + hook.name +" threw runtime exception.", e); } // if in end phase, shutdown hooks if (context.getPhase() == InstallContext.Phase.END) { hook.destroy(); } } return true; }