KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > sapia > taskman > TestRetryTask


1 package org.sapia.taskman;
2
3 /**
4  * @author Yanick Duchesne
5  * <dl>
6  * <dt><b>Copyright: </b>
7  * <dd>Copyright &#169; 2002-2003 <a
8  * HREF="http://www.sapia-oss.org">Sapia Open Source Software </a>. All
9  * Rights Reserved.</dd>
10  * </dt>
11  * <dt><b>License: </b>
12  * <dd>Read the license.txt file of the jar or visit the <a
13  * HREF="http://www.sapia-oss.org/license.html">license page </a> at the
14  * Sapia OSS web site</dd>
15  * </dt>
16  * </dl>
17  */

18 public class TestRetryTask extends RetryTask {
19   int _count = 0;
20   int _abortCount = 1;
21
22   TestRetryTask(int abortCount, int maxRetries) {
23     super(maxRetries);
24     _abortCount = abortCount;
25   }
26
27   /**
28    * @see org.sapia.taskman.RetryTask#doExec(org.sapia.taskman.TaskContext)
29    */

30   protected void doExec(TaskContext ctx) {
31     _count++;
32
33     if(_count == _abortCount) {
34       abort();
35     }
36   }
37 }
38
Popular Tags