public boolean validate(Long ksessionId, Long processInstanceId) { Long mapped = this.mapper.findMapping(ProcessInstanceIdContext.get(processInstanceId), this.identifier); if (Objects.equals(mapped, ksessionId)) { return true; } return false; }
public boolean validate(Long ksessionId, Long processInstanceId) { Long mapped = this.mapper.findMapping(ProcessInstanceIdContext.get(processInstanceId), this.identifier); if (Objects.equals(mapped, ksessionId)) { return true; } return false; }
@Override public void validate(KieSession ksession, Context<?> context) throws IllegalStateException { if (isClosed()) { throw new IllegalStateException("Runtime manager " + identifier + " is already closed"); } if (context == null || context.getContextId() == null) { return; } Long ksessionId = mapper.findMapping(context, this.identifier); if (ksessionId != null && ksession.getIdentifier() != ksessionId) { throw new IllegalStateException("Invalid session was used for this context " + context); } }
@Override public void validate(KieSession ksession, Context<?> context) throws IllegalStateException { if (isClosed()) { throw new IllegalStateException("Runtime manager " + identifier + " is already closed"); } if (context == null || context.getContextId() == null) { return; } Long ksessionId = mapper.findMapping(context, this.identifier); if (ksessionId == null) { // make sure ksession is not use by any other context Object contextId = mapper.findContextId(ksession.getIdentifier(), this.identifier); if (contextId != null && !contextId.equals(context.getContextId().toString())) { throw new IllegalStateException("KieSession with id " + ksession.getIdentifier() + " is already used by another context " + contextId + " expected is "+ context.getContextId()); } return; } if (ksession.getIdentifier() != ksessionId) { throw new IllegalStateException("Invalid session was used for this context " + context); } }
public void destroyCase(CaseContext caseContext) { KieSession kieSession = null; RuntimeEngine localRuntime = findLocalRuntime(caseContext.getContextId()); if (localRuntime != null) { kieSession = localRuntime.getKieSession(); } else { Long ksessionId = mapper.findMapping(caseContext, this.identifier); if (ksessionId != null) { kieSession = factory.findKieSessionById(ksessionId); } } factory.onDispose(kieSession.getIdentifier()); List<ExecutableCommand<?>> cmds = new ArrayList<>(); RemoveMappingCommand removeMapping = new RemoveMappingCommand(mapper, caseContext, getIdentifier()); cmds.add(removeMapping); DestroyKSessionCommand destroy = new DestroyKSessionCommand(kieSession, this); cmds.add(destroy); BatchExecutionCommand batchCmd = new BatchExecutionCommandImpl(cmds); kieSession.execute(batchCmd); }
ksessionId = mapper.findMapping(context, manager.getIdentifier()); if (ksessionId == null) { ksession = factory.newKieSession();
ksessionId = mapper.findMapping(context, this.identifier); if (ksessionId == null) { ksession = factory.newKieSession(); processInstanceId = (Long) contextId; Long ksessionId = mapper.findMapping(context, this.identifier); createLockOnGetEngine(ksessionId, runtime); saveLocalRuntime(caseId, processInstanceId, runtime);
Long found = mapper.findMapping(context, manager.getIdentifier()); if (found == null) { removeLocalRuntime(engine); return localRuntime.getKieSession(); ksessionId = mapper.findMapping(context, manager.getIdentifier()); if (ksessionId == null) { throw new SessionNotFoundException("No session found for context " + context.getContextId());
return localRuntime; ksessionId = mapper.findMapping(context, this.identifier); if (ksessionId == null) { throw new SessionNotFoundException("No session found for context " + context.getContextId());
public boolean validate(Long ksessionId, Long processInstanceId) { Long mapped = this.mapper.findMapping(ProcessInstanceIdContext.get(processInstanceId), this.identifier); if (Objects.equals(mapped, ksessionId)) { return true; } return false; }
public boolean validate(Long ksessionId, Long processInstanceId) { Long mapped = this.mapper.findMapping(ProcessInstanceIdContext.get(processInstanceId), this.identifier); if (Objects.equals(mapped, ksessionId)) { return true; } return false; }
@Override public void validate(KieSession ksession, Context<?> context) throws IllegalStateException { if (isClosed()) { throw new IllegalStateException("Runtime manager " + identifier + " is already closed"); } if (context == null || context.getContextId() == null) { return; } Long ksessionId = mapper.findMapping(context, this.identifier); if (ksessionId != null && ksession.getIdentifier() != ksessionId) { throw new IllegalStateException("Invalid session was used for this context " + context); } }
@Override public void validate(KieSession ksession, Context<?> context) throws IllegalStateException { if (isClosed()) { throw new IllegalStateException("Runtime manager " + identifier + " is already closed"); } if (context == null || context.getContextId() == null) { return; } Integer ksessionId = mapper.findMapping(context, getIdentifier()); if (ksessionId == null) { return; } if (ksession.getId() != ksessionId) { throw new IllegalStateException("Invalid session was used for this context " + context); } }
@Override public void validate(KieSession ksession, Context<?> context) throws IllegalStateException { if (isClosed()) { throw new IllegalStateException("Runtime manager " + identifier + " is already closed"); } if (context == null || context.getContextId() == null) { return; } Long ksessionId = mapper.findMapping(context, this.identifier); if (ksessionId == null) { // make sure ksession is not use by any other context Object contextId = mapper.findContextId(ksession.getIdentifier(), this.identifier); if (contextId != null && !contextId.equals(context.getContextId().toString())) { throw new IllegalStateException("KieSession with id " + ksession.getIdentifier() + " is already used by another context " + contextId + " expected is "+ context.getContextId()); } return; } if (ksession.getIdentifier() != ksessionId) { throw new IllegalStateException("Invalid session was used for this context " + context); } }
public void destroyCase(CaseContext caseContext) { KieSession kieSession = null; RuntimeEngine localRuntime = findLocalRuntime(caseContext.getContextId()); if (localRuntime != null) { kieSession = localRuntime.getKieSession(); } else { Long ksessionId = mapper.findMapping(caseContext, this.identifier); if (ksessionId != null) { kieSession = factory.findKieSessionById(ksessionId); } } factory.onDispose(kieSession.getIdentifier()); List<ExecutableCommand<?>> cmds = new ArrayList<>(); RemoveMappingCommand removeMapping = new RemoveMappingCommand(mapper, caseContext, getIdentifier()); cmds.add(removeMapping); DestroyKSessionCommand destroy = new DestroyKSessionCommand(kieSession, this); cmds.add(destroy); BatchExecutionCommand batchCmd = new BatchExecutionCommandImpl(cmds); kieSession.execute(batchCmd); }
ksessionId = mapper.findMapping(context, manager.getIdentifier()); if (ksessionId == null) { ksession = factory.newKieSession();
ksessionId = mapper.findMapping(context, this.identifier); if (ksessionId == null) { ksession = factory.newKieSession(); processInstanceId = (Long) contextId; Long ksessionId = mapper.findMapping(context, this.identifier); createLockOnGetEngine(ksessionId, runtime); saveLocalRuntime(caseId, processInstanceId, runtime);
Long found = mapper.findMapping(context, manager.getIdentifier()); if (found == null) { removeLocalRuntime(engine); return localRuntime.getKieSession(); ksessionId = mapper.findMapping(context, manager.getIdentifier()); if (ksessionId == null) { throw new SessionNotFoundException("No session found for context " + context.getContextId());
return localRuntime; ksessionId = mapper.findMapping(context, getIdentifier()); if (ksessionId == null) { //if we cannot find a KIE session, we will create one ksession = factory.newKieSession();
return localRuntime; ksessionId = mapper.findMapping(context, this.identifier); if (ksessionId == null) { throw new SessionNotFoundException("No session found for context " + context.getContextId());