1 package org.apache.jcs.utils.access;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 /***
23 * Interface for doing a piece of work which is expected to be cached. This is
24 * ment to be used in conjunction with JCSWorker.
25 * <p>
26 * Implement doWork() to return the work being done. isFinished() should return
27 * false until setFinished(true) is called, after which time it should return
28 * true.
29 * <p>
30 * @author tsavo
31 */
32 public interface JCSWorkerHelper
33 {
34 /***
35 * Tells us weather or not the work has been completed. This will be called
36 * automatically by JCSWorker. You should not call it yourself.
37 * <p>
38 * @return True if the work has allready been done, otherwise false.
39 */
40 public boolean isFinished();
41
42 /***
43 * Sets weather or not the work has been done.
44 * <p>
45 * @param isFinished
46 * True if the work has allready been done, otherwise false.
47 */
48 public void setFinished( boolean isFinished );
49
50 /***
51 * The method to implement to do the work that should be cached. JCSWorker
52 * will call this itself! You should not call this directly.
53 * <p>
54 * @return The result of doing the work to be cached.
55 * @throws Exception
56 * If anything goes wrong while doing the work, an Exception
57 * should be thrown.
58 */
59 public Object doWork()
60 throws Exception;
61 }