+ Start a Discussion
ipsips 

How to abort next execution of batch in batch job?

Hi,

I need to abort entire batch job if I get exception in any particular batch.

For e.g.. I have 10 batches for batchJob and exception occurred while executing 1 batch, next execution of batches are need to be aborted.

 

I have used System.abortJob()  method to abort the batch. But still I am not able to stop the next batch execution.

 

Thanks in advance..:)

Starz26Starz26

you could implement database.stateful

 

add a flag for abort

 

boolean abort = false;

 

check that flag and if true abort jub

 

now when the first error happens, set flag = true

ipsips

Hi,

Thanks for reply.

 

By using flag check I can avoid the execution of inner code of execute method.

But it will not stop next iteration of my batch. I think System.abortJob() method work in async. manner.