A solution is to change the class UserCodeActivityBehavior:
public void execute(ActivityExecution execution) throws Exception
{
ActivityBehaviour activityBehaviour = (ActivityBehaviour) customActivityReference
.getObject(execution);
activityBehaviour.execute(execution);
Propagation propagation = ((ExecutionImpl) execution).getPropagation();
if (propagation.equals(Propagation.WAIT))
((ExecutionImpl) execution).historyActivityStart();
else
((ExecutionImpl) execution).historyAutomatic();
}
public void signal(ActivityExecution execution, String signalName, Map<String, ?> parameters)
throws Exception
{
ExternalActivityBehaviour externalActivityBehaviour = (ExternalActivityBehaviour) customActivityReference
.getObject(execution);
externalActivityBehaviour.signal(execution, signalName, parameters);
TransitionImpl transition = ((ExecutionImpl) execution).getTransition();
if (transition != null)
((ExecutionImpl) execution).historyActivityEnd(transition.getName());
else
((ExecutionImpl) execution).historyActivityEnd();
}