cancel
Showing results for 
Search instead for 
Did you mean: 

Checking The Running Jobs inside from another Job in NW Java Scheduler

sugata_bagchi2
Active Contributor
0 Kudos

Hi Experts,

I have written one java class which will split the file in a certain location. I have scheduled this Java class to be executed by a Job in NW scheduler.

My question is , is it possible to check if there are any instance of a particular Job definition is running inside from another job?

For e.g - lets say I have created one Job Definition and scheduled a Task which should execute in every 5 minutes.
Now let us assume each job can take 15 minutes to complete, so when Job1 will start it will start splitting the file and after 5 minutes the Job2 will start.
So is there a way to check from Job2 if Job1 is completed? or any instance of the same Job definition is running in the Scheduler?

Your help is much appreciated!

Thanks

Sugata B

Accepted Solutions (0)

Answers (1)

Answers (1)

sugata_bagchi2
Active Contributor
0 Kudos

Hi Experts,

Please advise.. any Update?

Thanks

Sugata B

christian_santej
Active Participant
0 Kudos

Hi Sugata,

Have you checked the Job Scheduler API?

The Scheduler interface provides a method to retrieve Jobs by a JobFilter (It is possible to set the JobDefinition).

Example from the SAP Scheduler Javadoc:


JobIterator iter = scheduler.getJobs(myFilter, null, 1000);

Job[] jobs = iter.nextChunk();

// do something with the returned job ojbects

while(iter.hasMoreChunks()) {

  iter = scheduler.getJobs(myFilter, iter, 1000);

  Job[] jobs = iter.nextChunk();

  // do something with the returned job objects

  //

}

Regards,

Christian