I have a Async Service Task, I got the instance of RunTimeService from the context and tried this
RuntimeService runtimeService = Context.getProcessEngineConfiguration().getRuntimeService();
Boolean isSuspended = runtimeService.createProcessInstanceQuery().processInstanceId(execution.getProcessInstanceId()).singleResult().isSuspended();
if(!isSuspended) {
runtimeService.suspendProcessInstanceById(execution.getProcessInstanceId());
}
But the process seems to be continuing to next event/activity in the BPM model.
How is it possible to achieve actual suspension of a process Instance