Zum Hauptinhalt gehen

While getting context i am getting Class cast exception

Kommentare

2 Kommentare

  • Zendesk API User
    Author: Aradhana - 10/13/2022 6:14

    Thank you!! for the response i will try with ScheduleEntry.getRunningEntries().

    0
  • Zendesk API User
    Author: mbergmann - 10/12/2022 23:07

    Hi,

    when you are using an executable in a schedule entry, the given context is not a ScheduleTaskExecutionContext but a ScheduleContext. A ScheduleTaskExecutionContext (and maybe even JobAgent, but not sure about that) is (IIRC) only used/provided in combination with implementations of own custom schedule task types

    Beyond that: Not sure how the JobAgent should help here in the next step, I‘d rather recommend

    • reading the control‘s id via ScheduleContext.getExecutionId() (to have something to distinguish the „current“ schedule from it‘s „brothers“ later)
    • get the ScheduleStorage (via AdminService)
    • use the ScheduleStorage.getRunningEntries() - depending on your use case you will most likely have to do some filtering
    • … or maybe a better alternative depending on your use case: directly get ScheduleEntries for your current project and then filter (if needed) and use ScheduleEntry.getRunningEntries() if it’s just about a special ScheduleEntry in one project
    • however, you end up with a list of ScheduleEntryControl objects. On them you can use their stopExecution() method - but maybe use the remembered id to avoid killing that current entry (your running executable itself) if it’s own control could be among those you have at the end
    0

Bitte melden Sie sich an, um einen Kommentar zu hinterlassen.