Skip to content

Spring batch terminate in started status after sigterm #4023

@esoni

Description

@esoni

Hi All,
i have a job that run on k8s. During a shutdown for a cluster update k8s send SIGTERM to my container.
My goal is to

  • handle sigterm in a function
  • in this function i want to call stop job and wait the termination
    I m able to add a shutdown hook using
    Runtime.getRuntime().addShutdownHook(new Thread() {
    but in the meanwhile spring batch automatically terminate when i receive SIGTERM and the job remains in STARTED status on the db.
    How can customize this behavior ? i want to stop correctly the job when i receive sigterm

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions