// after the process end updates are posted to the database
JbpmContext jbpmContext = JbpmContext.getCurrentJbpmContext();
if (jbpmContext != null)
{
Services services = jbpmContext.getServices();
MessageService messageService = services.getMessageService();
PersistenceService persistenceService = services.getPersistenceService();
if (messageService != null
&& persistenceService != null
&& persistenceService.getJobSession().countDeletableJobsForProcessInstance(this) > 0)
{
CleanUpProcessJob job = new CleanUpProcessJob(rootToken);
job.setDueDate(new Date());
messageService.send(job);
}
}
}
}