Source:
<code>public AbstractRuntimeManager(RuntimeEnvironment environment, String identifier) { this.environment = environment; this.identifier = identifier; if (registry.isRegistered(identifier)) { throw new IllegalStateException("RuntimeManager with id " + identifier + " is already active"); } ((SimpleRuntimeEnvironment)environment).getEnvironmentTemplate().set(EnvironmentName.DEPLOYMENT_ID, this.getIdentifier()); internalSetDeploymentDescriptor(); internalSetKieContainer(); ((InternalRegisterableItemsFactory)environment.getRegisterableItemsFactory()).setRuntimeManager(this); String eagerInit = (String)((SimpleRuntimeEnvironment)environment).getEnvironmentTemplate().get("RuntimeEngineEagerInit"); if (eagerInit != null) { engineInitEager = Boolean.parseBoolean(eagerInit); } ExecutionErrorStorage storage = (ExecutionErrorStorage) ((SimpleRuntimeEnvironment)environment).getEnvironmentTemplate().get("ExecutionErrorStorage"); if (storage == null) { storage = new DefaultExecutionErrorStorage(environment.getEnvironment()); } this.executionErrorManager = new ExecutionErrorManagerImpl(storage); ((SimpleRuntimeEnvironment)environment).getEnvironmentTemplate().set(EnvironmentName.EXEC_ERROR_MANAGER, executionErrorManager); <START> if ((this instanceof SingletonRuntimeManager) && (environment instanceof SchedulerProvider)) { <END> GlobalSchedulerService schedulerService = ((SchedulerProvider) environment).getSchedulerService(); Class<?> clazz; try { clazz = Class.forName("org.jbpm.services.ejb.timer.EjbSchedulerService"); if (schedulerService != null && schedulerService.getClass().equals(clazz)) { logger.warn("Singleton with EJB Timer Service is not recommended as it's not stable under load"); } } catch (ClassNotFoundException e) { } } logger.info("{} is created for {}", this.getClass().getSimpleName(), identifier); }</code><technical_language>place in SingletonRuntimeManager? cast more</technical_language>

Target:
public AbstractRuntimeManager(RuntimeEnvironment environment, String identifier) { this.environment = environment; this.identifier = identifier; if (registry.isRegistered(identifier)) { throw new IllegalStateException("RuntimeManager with id " + identifier + " is already active"); } ((SimpleRuntimeEnvironment)environment).getEnvironmentTemplate().set(EnvironmentName.DEPLOYMENT_ID, this.getIdentifier()); internalSetDeploymentDescriptor(); internalSetKieContainer(); ((InternalRegisterableItemsFactory)environment.getRegisterableItemsFactory()).setRuntimeManager(this); String eagerInit = (String)((SimpleRuntimeEnvironment)environment).getEnvironmentTemplate().get("RuntimeEngineEagerInit"); if (eagerInit != null) { engineInitEager = Boolean.parseBoolean(eagerInit); } ExecutionErrorStorage storage = (ExecutionErrorStorage) ((SimpleRuntimeEnvironment)environment).getEnvironmentTemplate().get("ExecutionErrorStorage"); if (storage == null) { storage = new DefaultExecutionErrorStorage(environment.getEnvironment()); } this.executionErrorManager = new ExecutionErrorManagerImpl(storage); ((SimpleRuntimeEnvironment)environment).getEnvironmentTemplate().set(EnvironmentName.EXEC_ERROR_MANAGER, executionErrorManager); logger.info("{} is created for {}", this.getClass().getSimpleName(), identifier); }