if (delegate instanceof TaskListener) {
try {
Context.getProcessEngineConfiguration()
.getDelegateInterceptor()
.handleInvocation(new TaskListenerInvocation((TaskListener)delegate, delegateTask));
}catch (Exception e) {
throw new ActivitiException("Exception while invoking TaskListener: "+e.getMessage(), e);
}
} else {
throw new ActivitiIllegalArgumentException("Delegate expression " + expression