Details

    • Type: Task Task
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None

      Description

      • What is the point of lastFuture parameter in Trigger methods, it is not used in the examples?

      b. Future provided to Trigger.skipRun() would need to have result from different server, and future allows for get/cancel, and so forth. Do we really want the possibility of someone invoking those in a trigger?
      c. As an example, consider a Payroll that is triggered to run every Friday at midnight. If the server went down on Wednesday and then came back up, we still want to see the Payroll run automatically on Friday at midnight. But are we expected to provide the Future from last week's run before the outage?

      • what is the purpose of he baseTime parameter in:
        Date getNextRunTime(Future lastFuture,
        Date baseTime,
        Date lastActualRunTime,
        Date lastScheduledRunTime,
        Date lastCompleteTime)
        The description is circular:
        baseTime - the time in which the next fire time should be based.
        Do we mean the time for which the first execution was scheduled? If so, we should state that.

        Activity

        Hide
        anthony.lai added a comment -

        Comment from Andrew:

        b) I will need to look through the (old) mailing list archives for all the signatures on Trigger, and why Future is in there. It allows the Trigger to act based on the task, and probably even the information in the context object. I think the main reason it is there is to be able to get the result of the last execution, so the caller could just pass that. As you point out, most of the rest of the methods are not useful or dangerous.

        The two trigger methods (getNextRunTime(), skipRun()) should really get a LastExecution:

        interface LastExecution
        extends IdentifiedFuture

        { Object getResult() Date getScheduledStart() Date getRunStart() Date getRunEnd() }

        interface IdentifiedManagedFuture
        extends IdentifiedTask

        { String getManagedIdentifier() }

        interface IdentifiedTask

        { String getTaskIdentifier() }

        Semantics being:

        • If the Callable/Runnable passed to the the executor service implements IdentifiedTask then the executor service should call getTaskIdentifier(), store the value, and pass the value when called by a Trigger via LastExecution.
        • The executor service should assign a unique identifier to each newly submitted task.

        This allows the application server administrator or DevOps team to see their own identifiers when managing the executor service via the application server, and standardized log file correlation.

        c) The time would be the time at which the task was scheduled, which could be different from when the Trigger was created, or any information passed to the Trigger's constructor.

        The other three times could do with better descriptions. The other three useful times are:

        • the value getNextStartTime() returned (scheduled start) the previous time it was called;
        • the last time the task started (run start); and;
        • the last time the task ended (run end).

        Of these the task start/end need to be provided. The trigger could store the last value it returned, but this makes serialization more complex (the trigger would need to be reserialized after a call). I would expect the same set of times to be passed both to skipRun() and getNextStartTime(), the current signatures strike me as inconsistent, I think the LastExecution approach above is more elegant.

        Show
        anthony.lai added a comment - Comment from Andrew: b) I will need to look through the (old) mailing list archives for all the signatures on Trigger, and why Future is in there. It allows the Trigger to act based on the task, and probably even the information in the context object. I think the main reason it is there is to be able to get the result of the last execution, so the caller could just pass that. As you point out, most of the rest of the methods are not useful or dangerous. The two trigger methods (getNextRunTime(), skipRun()) should really get a LastExecution: interface LastExecution extends IdentifiedFuture { Object getResult() Date getScheduledStart() Date getRunStart() Date getRunEnd() } interface IdentifiedManagedFuture extends IdentifiedTask { String getManagedIdentifier() } interface IdentifiedTask { String getTaskIdentifier() } Semantics being: If the Callable/Runnable passed to the the executor service implements IdentifiedTask then the executor service should call getTaskIdentifier(), store the value, and pass the value when called by a Trigger via LastExecution. The executor service should assign a unique identifier to each newly submitted task. This allows the application server administrator or DevOps team to see their own identifiers when managing the executor service via the application server, and standardized log file correlation. c) The time would be the time at which the task was scheduled, which could be different from when the Trigger was created, or any information passed to the Trigger's constructor. The other three times could do with better descriptions. The other three useful times are: the value getNextStartTime() returned (scheduled start) the previous time it was called; the last time the task started (run start); and; the last time the task ended (run end). Of these the task start/end need to be provided. The trigger could store the last value it returned, but this makes serialization more complex (the trigger would need to be reserialized after a call). I would expect the same set of times to be passed both to skipRun() and getNextStartTime(), the current signatures strike me as inconsistent, I think the LastExecution approach above is more elegant.
        Hide
        anthony.lai added a comment -

        Checked in Trigger.java and LastExecution.java to source control on July 18 with the following changes:

        Modified Trigger interface to:

        Date getNextRunTime(LastExecution lastExecutionInfo,
        Date taskScheduledTime)

        boolean skipRun(LastExecution lastExecutionInfo,
        Date scheduledRunTime)

        and introduced a new interface javax.enterprise.concurrent.LastExecution:

        public interface LastExecution extends Identifiable

        { /** * Result of the last execution. * * @return The result of the last execution. It could return null if * the last execution did not complete, or the result of the task * was null. */ public Object getResult(); /** * The time in which the last task was scheduled to run. * * @return The date/time in which the last task was scheduled to run. */ public Date getScheduledStart(); /** * The time in which the last task started running. * * @return the date/time in which the last task started running, or * null if the task was canceled before it was started. */ public Date getRunStart(); /** * The time in which the last task was completed. * * @return the date/time in which the last task was completed, or * null if the task was canceled before it was completed. */ public Date getRunEnd(); }
        Show
        anthony.lai added a comment - Checked in Trigger.java and LastExecution.java to source control on July 18 with the following changes: Modified Trigger interface to: Date getNextRunTime(LastExecution lastExecutionInfo, Date taskScheduledTime) boolean skipRun(LastExecution lastExecutionInfo, Date scheduledRunTime) and introduced a new interface javax.enterprise.concurrent.LastExecution: public interface LastExecution extends Identifiable { /** * Result of the last execution. * * @return The result of the last execution. It could return null if * the last execution did not complete, or the result of the task * was null. */ public Object getResult(); /** * The time in which the last task was scheduled to run. * * @return The date/time in which the last task was scheduled to run. */ public Date getScheduledStart(); /** * The time in which the last task started running. * * @return the date/time in which the last task started running, or * null if the task was canceled before it was started. */ public Date getRunStart(); /** * The time in which the last task was completed. * * @return the date/time in which the last task was completed, or * null if the task was canceled before it was completed. */ public Date getRunEnd(); }

          People

          • Assignee:
            anthony.lai
            Reporter:
            anthony.lai
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: