Results 1 to 3 of 3

Thread: Job remains in JobState.RUNNING after Tasklet has completed

  1. #1
    Join Date
    Apr 2012
    Posts
    5

    Default Job remains in JobState.RUNNING after Tasklet has completed

    Hi Costin,

    I am successfully executing a Hadoop JobTasklet. I am using Quartz to kick-off the job every few minutes (the job takes about 30 seconds to complete). My problem is that I cannot kick off 2 or more jobs.

    My problem appears to be in the JobTasklet.execute() method. I have "wait for job" set to true so the code executes "job.waitForCompletion(false);". This immediately submits a job to the cluster because Job.state=DEFINE.

    However, when Quartz kicks off my second job, I see that "Job.state == RUNNING" and this causes execution to block until my previous job is marked as FINISHED (which happens immediately because JobClient.isComplete() determines that the job has completed). Execution then falls back to JobTasklet.execute() and RepeatStatus.FINISHED is returned.

    The bottom line is that my second job is never executed. Instead, it simply waits for my previous job to be marked as completed and then nothing else happens.

    Can you tell from my description if I am doing something incorrect?*
    Thanks in advance for any help you can offer.

    Rob.

  2. #2
    Join Date
    Jan 2005
    Location
    Bucharest, Romania
    Posts
    5,403

    Default

    Posting your configuration should help. It sounds like you need to make the tasklet and its associated job a prototype (in M2 only the job will most likely be required). You want on each invocation a new job to be executed but since the same job instance is used, on the second run the scheduler triggers the old job which is running so that's why it waits for it and then finishes.

    Does this make sense?
    Costin Leau
    SpringSource - http://www.SpringSource.com- Spring Training, Consulting, and Support - "From the Source"
    http://twitter.com/costinl
    Please use [ c o d e ] [ / c o d e ] tags

  3. #3
    Join Date
    Apr 2012
    Posts
    5

    Default

    Hi Costin,

    Thanks for your reply. I will let you know how I get on with your suggestion as soon as possible.

    Rob.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •