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?
- 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.
- 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".
- 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
- 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]
- at this point, you will notice that the application has exited, without displaying the job execution results
- 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 ...
- 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
In addition, There are 2 privileged places you can go to: