KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > oddjob > dummy > DummyExistsJob


1 package org.oddjob.dummy;
2
3 import java.io.File JavaDoc;
4
5 import org.oddjob.framework.SimpleJob;
6
7
8 public class DummyExistsJob extends SimpleJob {
9
10     public void setFile(File JavaDoc file) { }
11     
12     public int execute() throws Exception JavaDoc {
13
14         if (Math.random() > 0.9) {
15             
16             throw new Exception JavaDoc("Pretend File Exception");
17         }
18         
19         if (Math.random() > 0.5 ) {
20         
21             return 1;
22         }
23         else {
24             
25             return 0;
26         }
27     }
28 }
29
Popular Tags