public List<String> getDeployments() { List<String> deploymentIds = new ArrayList<>(RuntimeManagerRegistry.get().getRegisteredIdentifiers()); // add jbpm as trigger group for backward compatibility deploymentIds.add("jbpm"); return deploymentIds; }
@Override public void execute(JobContext ctx) { RuntimeManager runtimeManager = null; RuntimeEngine engine = null; CommandExecutor executor = null; if (deploymentId != null && processInstanceId != null) { runtimeManager = RuntimeManagerRegistry.get().getManager(deploymentId); engine = runtimeManager.getRuntimeEngine(ProcessInstanceIdContext.get(processInstanceId)); executor = engine.getTaskService(); } else { executor = TaskDeadlinesServiceImpl.getInstance(); } try { executor.execute(new ExecuteDeadlinesCommand(taskId, deadlineId, type)); } catch (NullPointerException e) { logger.error("TaskDeadlineService instance is not available, most likely was not properly initialized - Job did not run!"); } finally { if (runtimeManager != null && engine != null) { runtimeManager.disposeRuntimeEngine(engine); } } }
@After public void teardown() { executorService.destroy(); if (manager != null) { RuntimeManagerRegistry.get().remove(manager.getIdentifier()); manager.close(); } if (emf != null) { emf.close(); } if (emfErrors != null) { emfErrors.close(); } pds.close(); }
public ScheduledTaskDeadline call() throws Exception { RuntimeManager runtimeManager = null; RuntimeEngine engine = null; CommandExecutor executor = null; if (deploymentId != null && processInstanceId != null) { runtimeManager = RuntimeManagerRegistry.get().getManager(deploymentId); engine = runtimeManager.getRuntimeEngine(ProcessInstanceIdContext.get(processInstanceId)); executor = engine.getTaskService(); } else { executor = TaskDeadlinesServiceImpl.getInstance(); } try { executor.execute(new ExecuteDeadlinesCommand(taskId, deadlineId, type)); } catch (NullPointerException e) { logger.error("TaskDeadlineService instance is not available, most likely was not properly initialized - Job did not run!"); } finally { if (runtimeManager != null && engine != null) { runtimeManager.disposeRuntimeEngine(engine); } } return null; }
@After public void teardown() { executorService.destroy(); if (manager != null) { RuntimeManagerRegistry.get().remove(manager.getIdentifier()); manager.close(); } if (emf != null) { emf.close(); } pds.close(); }
public List<String> getDeployments() { List<String> deploymentIds = new ArrayList<>(RuntimeManagerRegistry.get().getRegisteredIdentifiers()); // add jbpm as trigger group for backward compatibility deploymentIds.add("jbpm"); return deploymentIds; }
RuntimeManager runtimeManager = RuntimeManagerRegistry.get().getManager(deploymentId); if (runtimeManager == null) { throw new IllegalArgumentException("No runtime manager found for deployment id " + deploymentId);
@After public void teardown() { executorService.destroy(); if (manager != null) { RuntimeManagerRegistry.get().remove(manager.getIdentifier()); manager.close(); } if (emf != null) { emf.close(); } pds.close(); }
protected List<String> getDeploymentIds() { List<String> deployed = new ArrayList<>(RuntimeManagerRegistry.get().getRegisteredIdentifiers()); if (deployed.isEmpty()) { deployed.add(""); } return deployed; } }
@Override public ExecutionResults execute(CommandContext ctx) throws Exception { String deploymentId = (String) ctx.getData("deploymentId"); if (deploymentId == null) { deploymentId = (String) ctx.getData("DeploymentId"); } Long processInstanceId = (Long) ctx.getData("processInstanceId"); if (processInstanceId == null) { processInstanceId = (Long) ctx.getData("ProcessInstanceId"); } String signal = (String) ctx.getData("Signal"); Object event = ctx.getData("Event"); if (deploymentId == null || signal == null) { throw new IllegalArgumentException("Deployment id and signal name is required"); } RuntimeManager runtimeManager = RuntimeManagerRegistry.get().getManager(deploymentId); if (runtimeManager == null) { throw new IllegalArgumentException("No runtime manager found for deployment id " + deploymentId); } RuntimeEngine engine = runtimeManager.getRuntimeEngine(ProcessInstanceIdContext.get(processInstanceId)); try { engine.getKieSession().signalEvent(signal, event, processInstanceId); return new ExecutionResults(); } finally { runtimeManager.disposeRuntimeEngine(engine); } }
@After public void teardown() { executorService.destroy(); if (manager != null) { RuntimeManagerRegistry.get().remove(manager.getIdentifier()); manager.close(); } if (emf != null) { emf.close(); } pds.close(); }
if (!RuntimeManagerRegistry.get().isRegistered(migrationSpec.getDeploymentId())) { report.addEntry(Type.ERROR, "No deployment found for " + migrationSpec.getDeploymentId()); if (!RuntimeManagerRegistry.get().isRegistered(migrationSpec.getToDeploymentId())) { report.addEntry(Type.ERROR, "No target deployment found for " + migrationSpec.getToDeploymentId()); InternalRuntimeManager manager = (InternalRuntimeManager) RuntimeManagerRegistry.get().getManager(migrationSpec.getToDeploymentId()); if (manager.getEnvironment().getKieBase().getProcess(migrationSpec.getToProcessId()) == null) { report.addEntry(Type.ERROR, "No process found for " + migrationSpec.getToProcessId() + " in deployment " + migrationSpec.getToDeploymentId()); InternalRuntimeManager sourceManager = (InternalRuntimeManager) RuntimeManagerRegistry.get().getManager(migrationSpec.getDeploymentId()); if (!sourceManager.getClass().isAssignableFrom(manager.getClass())) { report.addEntry(Type.ERROR, "Source (" + sourceManager.getClass().getName() + ") and target (" + manager.getClass().getName() + ") deployments are of different type (they represent different runtime strategies)");
@After public void teardown() { executorService.destroy(); if (manager != null) { RuntimeManagerRegistry.get().remove(manager.getIdentifier()); manager.close(); } if (emf != null) { emf.close(); } pds.close(); }
TransactionManager txm = null; boolean transactionOwner = false; InternalRuntimeManager currentManager = (InternalRuntimeManager) RuntimeManagerRegistry.get().getManager(migrationSpec.getDeploymentId()); InternalRuntimeManager toBeManager = (InternalRuntimeManager) RuntimeManagerRegistry.get().getManager(migrationSpec.getToDeploymentId());
@After public void teardown() { executorService.destroy(); if (manager != null) { RuntimeManagerRegistry.get().remove(manager.getIdentifier()); manager.close(); } if (emf != null) { emf.close(); } pds.close(); }
protected RuntimeManager getRuntimeManager(CommandContext ctx) { String deploymentId = (String) ctx.getData("deploymentId"); RuntimeManager runtimeManager = RuntimeManagerRegistry.get().getManager(deploymentId); if (runtimeManager == null) { throw new IllegalStateException("There is no runtime manager for deployment " + deploymentId); } return runtimeManager; }
@After public void teardown() { executorService.destroy(); if (manager != null) { RuntimeManagerRegistry.get().remove(manager.getIdentifier()); manager.close(); } if (emf != null) { emf.close(); } pds.close(); }
protected RuntimeEngine getRuntimeEngine(String releaseId, Long processInstanceId) { RuntimeManager manager = RuntimeManagerRegistry.get().getManager(releaseId); Context<?> context = EmptyContext.get(); if (processInstanceId != null && manager instanceof PerProcessInstanceRuntimeManager) { context = ProcessInstanceIdContext.get(processInstanceId); } if (manager != null) { RuntimeEngine engine = manager.getRuntimeEngine(context); return engine; } return null; }
protected ClassLoader getClassLoader(String deploymentId) { ClassLoader cl = Thread.currentThread().getContextClassLoader(); if (deploymentId == null) { return cl; } InternalRuntimeManager manager = ((InternalRuntimeManager)RuntimeManagerRegistry.get().getManager(deploymentId)); if (manager != null && manager.getEnvironment().getClassLoader() != null) { cl = manager.getEnvironment().getClassLoader(); } return cl; }
protected ClassLoader getClassLoader(String deploymentId) { ClassLoader cl = Thread.currentThread().getContextClassLoader(); if (deploymentId == null) { return cl; } InternalRuntimeManager manager = ((InternalRuntimeManager) RuntimeManagerRegistry.get().getManager(deploymentId)); if (manager != null && manager.getEnvironment().getClassLoader() != null) { cl = manager.getEnvironment().getClassLoader(); } return cl; }