|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.agentfactory.cldc.scheduler.ThreadTask
public class ThreadTask
In AFME, agents and other tasks are scheduled to execute at periodic intervals. The task to be scheduled must implement the runnable interface. The ThreadTask associates the task to be executed with an execution time. The scheduler places thread task in a buffer. At execution time the thread task is extracted from the buffer and subseqently executed by worker threads.
| Constructor Summary | |
|---|---|
ThreadTask(java.lang.Runnable runnable,
ExTime et)
Creates a new instance of ThreadTask. |
|
| Method Summary | |
|---|---|
long |
calcSleepTime()
Calculates the amount of time the scheduler should sleep until it reaches the execution time. |
boolean |
equalsProcess(java.lang.Runnable run)
Checks whether the runnable task within this thread task is equal to the specified runnable task. |
void |
removeTime(java.util.Hashtable table)
If there are no more agents schedule at the execution time interval, the execution time interval will be removed from the specified hash table. |
void |
run()
Executes the runnable task. |
boolean |
schedule()
Calculates the next execution time at which the task will be executed. |
boolean |
sooner(ThreadTask task)
Checks whether this task will execute sooner than the specified task. |
void |
writeAgent(java.io.DataOutputStream dos)
Writes the state of the runnable object (Agent) to the specified data output stream. |
void |
writeTime(java.io.DataOutputStream dos)
Writes the execution time to the specified data output stream. |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public ThreadTask(java.lang.Runnable runnable,
ExTime et)
runnable - the task to be executed.et - the execution time.| Method Detail |
|---|
public void removeTime(java.util.Hashtable table)
table - the hash table that the execution time interval is to be removed from.public boolean equalsProcess(java.lang.Runnable run)
run - the specified runnalbe task.
public boolean sooner(ThreadTask task)
task - the specified task.
public long calcSleepTime()
public boolean schedule()
throws MalformedLogicException
MalformedLogicException - if there is a logic error.public void run()
run in interface java.lang.Runnable
public void writeAgent(java.io.DataOutputStream dos)
throws java.io.IOException
dos - the data output stream to write the state of the agent to.
java.io.IOException - if there is an I/O error.
public void writeTime(java.io.DataOutputStream dos)
throws java.io.IOException
dos - the data output stream to write the execution time to.
java.io.IOException - if there is an I/O error.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||