Announcement Announcement Module
Collapse
No announcement yet.
Stopping a Spring Batch Job Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Stopping a Spring Batch Job

    Hi All

    I am having tough time to stop a batch job and eventually the scheduler.

    Basically, I start a job from a shell script where I call the main method of

    Code:
    public class SPCPILScheduler 
    {
    
    	public static void main(String[] args) 
    	{
    		try
    		{
    			JobRegistryBackgroundJobRunner.main("launchContext.xml", "printJob.xml");
    		}
    		catch (Exception e)
    		{
    			e.printStackTrace();
    		}
    	}
    }
    Now, I want to have a shell script which will stop the jobs and eventually the scheduler. This shell script will call the main method of a different class.

    If I simply call
    Code:
    JobRegistryBackgroundJobRunner.stop()
    , it doesn't do anything.

    Please help me.

    Thanks a lot
    Prabodh Prakash

  • #2
    Got the answer myself.

    The process involve loading application context and then getting Job Operator bean and using it to stop the batch.

    Comment

    Working...
    X