Announcement Announcement Module
No announcement yet.
whant to restart task automatic on failover Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • whant to restart task automatic on failover


    we are planning to deploy spring batch in a webserver environment.
    on weblogic in cluster environment. if one job is in running and the one node of cluster fails in which job was running than what will happen ? as cluster will send request to another active node.
    I think JobExecutionAlreadyRunningException will come ?
    I don't want this exception to come I want my job should restart from where it left ? what could be the solution in this situation ?

    is there any way to determine failover ? and can i write a program so that it will set status of job properly in this situation so that my job will restart automaticaly as another node will process the request?

  • #2
    how to handle fail over ???

    hope to get solution soon ....
    problem cont....
    I don't have knowledge of web cluster environment ...If I am approaching something wrong please let me know..
    I am calling batch process from Jsp..
    if I shut down one node(instance of tomcat) in which batch process was running I am not getting any response on Jsp from which it call but in this case status of step it sets fail and end time also . why it is happening not getting ... ?

    but request was not continue on another node ? so I have to again call the batch process and it will start correctly.
    I am not getting why it is not giving any response on jsp why i need to refresh it to continue process ...?

    but if I close one node force fully that is ending the process of node in this case request is transfer to another node but I get job instance already running exception as it not set any status and end time in stepexecution .

    how to handle this situation any Idea ?


    • #3
      Well here are a few things that i would do, havent done it yet locally but thinking about it.

      You should be able to add a listener in WebSphere through an MBean or somethign to detect server shut down.

      When you do there are items in spring to pull all running jobs:

      Iterate through all the jobs and use the job operator to stop them. So you can gracefull stop them.

      Now here is where it gets tricky you are gonna have to mark what jobs you stopped. Maybe update the job description etc.

      ON restart you can restart any job and i believe it starts over from the last fully successful job so your app will have to handle the idea of duplicates etc.

      Also if u have a HARD restart then you should be able to determine that at restart time by checking items that are in a STARTED status but arent really started since the server just restarted.

      So again its not OVERLY hard. But the biggest thing will be this "have you coded correctly so your jobs can handle restarts" ... ours took some work to do but we have fairly successfuly.