@Override protected void destroyMembers(@Nonnull MVCGroup group, boolean fireDestructionEvents) { super.destroyMembers(group, fireDestructionEvents); try { FactoryBuilderSupport builder = (FactoryBuilderSupport) group.getMember(BUILDER); if (builder != null) { builder.dispose(); builder.getVariables().clear(); } } catch (Exception e) { // TODO find out why this call breaks applet mode on shutdown LOG.error( "Application encountered an error while destroying group '" + group.getMvcId() + "'", sanitize(e)); } }
@Nonnull @Override @SuppressWarnings("unchecked") protected Map<String, Object> instantiateMembers( @Nonnull Map<String, ClassHolder> classMap, @Nonnull Map<String, Object> args) { Map<String, Object> map = super.instantiateMembers(classMap, args); FactoryBuilderSupport builder = createBuilder(getApplication()); map.put(BUILDER, builder); for (Object member : map.values()) { // all scripts get the builder as their binding if (member instanceof Script) { builder.getVariables().putAll(((Script) member).getBinding().getVariables()); ((Script) member).setBinding(builder); } } return map; }