Class JobService
java.lang.Object
edu.ucsb.cs156.frontiers.services.jobs.JobService
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetJobLogs(Long jobId) runAsJob(JobContextConsumer jobFunction) voidrunJobAsync(Job job, JobContextConsumer jobFunction) Runs a job asynchronously.
-
Constructor Details
-
JobService
public JobService()
-
-
Method Details
-
runAsJob
-
runJobAsync
Runs a job asynchronously.This method is annotated with @Transactional because outside of the Spring context, you cannot delete entities that are unmanaged by Hibernate. Adding @Transactional keeps the database session open and allows Hibernate to maintain it's knowledge of the object graph (i.e. the entities)
To learn more, read about Hibernate and the concept of a Spring Context.
Note that @Transactional means that if there is an unhandled exception, either every database transactions succeeds, or all of them are rolled back.
- Parameters:
job-jobFunction-
-
getJobLogs
-