public void onManagementStopped(ManagementTransitionInfo info) { synchronized (this) { if (managementContext != info.getManagementContext()) { throw new IllegalStateException("Has different management context: "+managementContext+"; expected "+info.getManagementContext()); } if (subscriptionContext != null) subscriptionContext.unsubscribeAll(); entityChangeListener = EntityChangeListener.NOOP; managementContextUsable.set(false); currentlyDeployed.set(false); executionContext = null; subscriptionContext = null; } // TODO framework stopped activities, e.g. serialize state ? entity.invalidateReferences(); synchronized (this) { managementContext = null; nonDeploymentManagementContext.setMode(NonDeploymentManagementContext.NonDeploymentManagementContextMode.MANAGEMENT_STOPPED); } }