if(_enabled && (event instanceof ProcessInstanceEvent) &&
// I have this excluded since we are recursing here when onEvent()
// is called from DebugSupport codepath's which change state
!(event instanceof ProcessInstanceStateChangeEvent)) {
final ProcessInstanceEvent evt = (ProcessInstanceEvent)event;
//
// prevent leaking of memory
//
if(evt instanceof ProcessCompletionEvent ||
evt instanceof ProcessTerminationEvent) {
_step.remove(evt.getProcessInstanceId());
_instanceBreakPoints.remove(evt.getProcessInstanceId());
return;
}
boolean suspend = checkStep(evt);
if (!suspend) {
suspend = checkBreakPoints(evt, _globalBreakPoints);
}
if (!suspend){
Breakpoint[] bp = _instanceBreakPoints.get(evt.getProcessInstanceId());
if(bp != null) {
suspend = checkBreakPoints(evt, bp);
}
}
if(suspend){
_step.remove(evt.getProcessInstanceId());
try {
ProcessDAO process = _db.getProcessDAO();
ProcessInstanceDAO instance = process.getInstance(evt.getProcessInstanceId());
if(ProcessState.canExecute(instance.getState())){
// send event
ProcessInstanceStateChangeEvent changeEvent = new ProcessInstanceStateChangeEvent();
changeEvent.setOldState(instance.getState());
instance.setState(ProcessState.STATE_SUSPENDED);