Class ScheduledProcessStartEventImpl

java.lang.Object
de.aristaflow.adept2.core.eventmanager.common.AbstractEvent
de.aristaflow.adept2.core.eventmanager.timeevents.ScheduledProcessStartEventImpl
All Implemented Interfaces:
ScheduledProcessStartEvent, Event, TimeScheduleEvent

public class ScheduledProcessStartEventImpl extends AbstractEvent implements ScheduledProcessStartEvent
An event of a scheduled process start for one of its due times. A handler may set the outcome on another thread than the one of the source reading it, so the outcome is accessed under the lock of the event.
  • Field Details

    • processStart

      protected final ScheduledProcessStart processStart
      The scheduled process start which has raised this event.
    • dueTime

      protected final Instant dueTime
      The due time for which this event has been raised.
    • lastInstance

      protected final UUID lastInstance
      The ID of the instance which the last successful trigger of the start has started, null if no trigger has started one.
    • startedInstance

      protected UUID startedInstance
      The ID of the instance which the trigger of this event has started, null unless this is its outcome.
    • lastFailedAttempt

      protected Instant lastFailedAttempt
      The time of the last failed attempt of the trigger of this event, null unless every attempt has failed.
    • skipped

      protected boolean skipped
      Whether the trigger of this event has skipped its due time.
  • Constructor Details

    • ScheduledProcessStartEventImpl

      public ScheduledProcessStartEventImpl(URI[] managerURI, String eventType, String sourceType, String sourceID, ScheduledProcessStart processStart, Instant dueTime, UUID lastInstance)
      Creates a new event of the designated scheduled process start for the designated due time.
      Parameters:
      managerURI - The URIs of the service (event manager) creating the event.
      eventType - The type of the event.
      sourceType - The type of the source of this event.
      sourceID - The ID of the source of this event.
      processStart - The scheduled process start which raises the event. This must not be null.
      dueTime - The due time for which the event is raised. This must not be null.
      lastInstance - The ID of the instance which the last successful trigger of the start has started or null if no trigger has started one.
  • Method Details

    • getDueTime

      public Instant getDueTime()
      Description copied from interface: TimeScheduleEvent
      Gets the due time for which this event has been raised. It lies before the creation of the event if the due time is handled late, for instance after it has passed while no source ran.
      Specified by:
      getDueTime in interface TimeScheduleEvent
      Returns:
      The due time for which this event has been raised. This will never be null.
    • getSchedule

      public TimeSchedule getSchedule()
      Description copied from interface: TimeScheduleEvent
      Gets the time schedule of which a due time has raised this event.
      Specified by:
      getSchedule in interface TimeScheduleEvent
      Returns:
      The time schedule of which a due time has raised this event. This will never be null.
    • getScheduledProcessStart

      public ScheduledProcessStart getScheduledProcessStart()
      Description copied from interface: ScheduledProcessStartEvent
      Gets the scheduled process start which has raised this event.
      Specified by:
      getScheduledProcessStart in interface ScheduledProcessStartEvent
      Returns:
      The scheduled process start which has raised this event. This will never be null.
    • getLastInstance

      public UUID getLastInstance()
      Description copied from interface: ScheduledProcessStartEvent
      Gets the ID of the instance which the last successful trigger of the start has started. A start with a fixed rate which allows no overlapping instances skips its due time while this instance runs.
      Specified by:
      getLastInstance in interface ScheduledProcessStartEvent
      Returns:
      The ID of the instance which the last successful trigger of the start has started or null if no trigger has started one.
    • setStarted

      public void setStarted(UUID instanceID)
      Description copied from interface: ScheduledProcessStartEvent
      Sets the outcome of the trigger of this event: it has started the instance of the designated ID. This replaces an outcome set before.
      Specified by:
      setStarted in interface ScheduledProcessStartEvent
      Parameters:
      instanceID - The ID of the started instance. This must not be null.
    • setFailed

      public void setFailed(Instant lastAttempt)
      Description copied from interface: ScheduledProcessStartEvent
      Sets the outcome of the trigger of this event: every attempt to start an instance has failed, the last one at the designated time. This replaces an outcome set before.
      Specified by:
      setFailed in interface ScheduledProcessStartEvent
      Parameters:
      lastAttempt - The time of the last failed attempt. This must not be null.
    • setSkipped

      public void setSkipped()
      Description copied from interface: ScheduledProcessStartEvent
      Sets the outcome of the trigger of this event: it has skipped its due time without attempting to start an instance. This replaces an outcome set before.
      Specified by:
      setSkipped in interface ScheduledProcessStartEvent
    • getStartedInstance

      public UUID getStartedInstance()
      Description copied from interface: ScheduledProcessStartEvent
      Gets the ID of the instance which the trigger of this event has started.
      Specified by:
      getStartedInstance in interface ScheduledProcessStartEvent
      Returns:
      The ID of the instance which the trigger of this event has started or null if its outcome is another one or it has none.
    • getLastFailedAttempt

      public Instant getLastFailedAttempt()
      Description copied from interface: ScheduledProcessStartEvent
      Gets the time of the last failed attempt of the trigger of this event.
      Specified by:
      getLastFailedAttempt in interface ScheduledProcessStartEvent
      Returns:
      The time of the last failed attempt of the trigger of this event or null if its outcome is another one or it has none.
    • isSkipped

      public boolean isSkipped()
      Description copied from interface: ScheduledProcessStartEvent
      Gets whether the trigger of this event has skipped its due time.
      Specified by:
      isSkipped in interface ScheduledProcessStartEvent
      Returns:
      Whether the trigger of this event has skipped its due time.