jobsToInsert.add(job);
}
}
// Save logic
Transaction transaction = jedis.multi();
boolean discard = true;
try
{
// Persist not persisted Jobs
for (Job job : jobsToInsert)
{
job.setParentTaskId(task.getTaskId());
jobDao.save(job, transaction);
}
// Persist task
taskDao.save(task, transaction);
// Index task and owner
deindexTaskByOwner(task, transaction);
indexTaskByOwner(task, transaction);
indexTaskOwner(task, transaction);
transaction.exec();
discard = false;
}
finally
{
if (discard)
{
transaction.discard();
}
jedisPool.returnResource(jedis);
}