KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > knowgate > scheduler > WorkerThreadCallback


1 package com.knowgate.scheduler;
2
3 /**
4  * <p>Get information about what is happening inside each WorkerThread</p>
5  * This an abstract base class than must be inherited in order to provide the
6  * implementation for the call() method.
7  * @author Sergio Montoro Ten
8  * @version 1.0
9  */

10
11 public abstract class WorkerThreadCallback {
12   private String JavaDoc sName;
13
14   /**
15    * @param sCallbackName Each callback instance must have a unique name
16    */

17   public WorkerThreadCallback(String JavaDoc sCallbackName) {
18     sName = sCallbackName;
19   }
20
21   /**
22    * @return Callback instance name
23    */

24   public String JavaDoc name() {
25     return sName;
26   }
27
28   /**
29    * <p>Provide information about thread execution milestones</p>
30    * @param sThreadId String identifying the caller WorkerThread
31    * @param iOpCode Operation code (see static constants)
32    * @param sMessage Descriptive message
33    * @param oXcpt Exception thrown by WorkerThread.<br>
34    * This parameter is always null unless iOpCode is WT_EXCEPTION
35    * @param oParam Object related to operation.<br>
36    * Its class depends on the operation performed.<br>
37    */

38   public abstract void call(String JavaDoc sThreadId, int iOpCode, String JavaDoc sMessage, Exception JavaDoc oXcpt, Object JavaDoc oParam);
39
40   /**
41    * <p>Thread throwed and Exception</p>
42    * <p>The throwed Exception will be in the 4th parameter of call() method</p>
43    */

44   public static final int WT_EXCEPTION = -1;
45
46   /**
47    * <p>Thread instantiated a Job subclass</p>
48    * <p>A reference to the instantiated Job will be in the 5th parameter of call() method</p>
49    */

50   public static final int WT_JOB_INSTANTIATE = 1;
51
52   /**
53    * <p>Thread finished a Job execution</p>
54    * <p>A reference to the finished Job will be in the 5th parameter of call() method</p>
55    */

56   public static final int WT_JOB_FINISH = 2;
57
58   /**
59    * <p>AtomConsumer for thread found no more pending Atoms</p>
60    * <p>A reference to the AtomConsumer will be in the 5th parameter of call() method</p>
61    */

62   public static final int WT_ATOMCONSUMER_NOMORE = 3;
63
64   /**
65    * <p>Thread just got an Atom for its inmediate consumption.</p>
66    * <p>Called before Atom is consumed.</p>
67    * <p>A reference to the Atom will be in the 5th parameter of call() method</p>
68    */

69   public static final int WT_ATOM_GET = 4;
70
71   /**
72    * <p>Thread consumed an Atom.</p>
73    * <p>Called after Atom is consumed.</p>
74    * <p>A reference to the Atom will be in the 5th parameter of call() method</p>
75    */

76   public static final int WT_ATOM_CONSUME = 5;
77
78 } // WorkerThreadCallback
Popular Tags