JPPF
 Home   About   Download   Documentation   Forums 

Job Recovery example

What does the sample do?

This sample demonstrates how the state of a JPPF job can be persisted on the client side, then recovered after a client crash.
For this purpose, the demo application submits a job then, while the job is still executing, exits brutally. The next time the application is started, it reads the latest persisted state of the job and submits it again to the grid. Only the part of the job that hadn't completed will be executed.

How do I run it?

  1. Before running this sample application, you must have a JPPF server and one node running. For information on how to set up a node and server, please refer to the JPPF documentation.
  2. Once you have a server and node, you can either run the "run.bat" script (on Windows), "./run.sh" script (on Linux/Unix) or, from a command prompt, type: "ant run".
  3. A the first execution, the application will show that no job exists in the job perisstence store, with a message similar to this:
    no job found in persistence store, creating a new job with 10 tasks
  4. You will then see, in the node's shell console, messages like this:
    task 1 completed sucessfully
    ...
    task 5 completed sucessfully
    task 6 completed with error [java.lang.InterruptedException: sleep interrupted]
  5. at this point, you will notice that the application has exited, without displaying the job execution results
  6. restart the application: you should now see a message like:
    found jobs in persistence store: [the_job_uuid]
    loaded job 'the_job_uuid' from persistence store ...
  7. the node's console will again display successful completion messages, but starting from the latest task that was successfully persisted

Related source files

  • Runner.java : this is the application that submits a job, simulates a crash, and performs the job recovery
  • MyTask.java : a JPPF task that simply waits for one second before completing

How can I build the sample?

To compile the source code, from a command prompt, type: "ant compile"
To generate the Javadoc, from a command prompt, type: "ant javadoc"

I have additional questions and comments, where can I go?

If you need more insight into the code of this demo, you can consult the source, or have a look at the API documentation.

In addition, There are 2 privileged places you can go to:

Support This Project Copyright © 2005-2013 JPPF.org Powered by Parallel Matters  Get JPPF at SourceForge.net. Fast, secure and Free Open Source software downloads