java.lang.Object
com.netflix.genie.web.data.services.impl.jpa.listeners.JobEntityListener

public class JobEntityListener extends Object
Listener for Job JPA entity (JobEntity). Currently tracks persistent changes to the status of a job and notifies an observer. Could be extended to do proxy more persist changes.

N.B. Spring configuration. - This class does not appear in any AutoConfiguration as bean. It is referenced as EventListener by JobEntity. EntityManager creates it even if a bean of the same type exists already. - The constructor parameter persistedJobStatusObserver is marked Nullable so that an instance can be created even if no bean of that type is configured.

Since:
4.0.0
  • Constructor Details

    • JobEntityListener

      public JobEntityListener(PersistedJobStatusObserver persistedJobStatusObserver)
      Constructor.
      Parameters:
      persistedJobStatusObserver - the observer to notify of persisted job status changes
  • Method Details

    • jobUpdate

      public void jobUpdate(JobEntity jobEntity)
      Persistence callback invoked after a job entity has been committed/flushed into persistent storage. If the persisted status of the job is different from the last one notified, then a notification is emitted.
      Parameters:
      jobEntity - the job that was just persisted
    • jobLoad

      public void jobLoad(JobEntity jobEntity)
      Persistence callback invoked after a job entity is loaded or refreshed. The job status loaded from persistent storage is also the last state that was notified.
      Parameters:
      jobEntity - the job that was just loaded