|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--java.lang.Thread | +--jason.core.pool.ThreadCapsuleImpl
Field Summary | |
protected Task |
coreThread
|
protected boolean |
keepAlive
|
Fields inherited from class java.lang.Thread |
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY |
Constructor Summary | |
ThreadCapsuleImpl()
This capsule waits until a setTask is called |
|
ThreadCapsuleImpl(Task task)
Start the ThreadCapsule with a task |
Method Summary | |
void |
activateThreadCapsule()
This method should be called only if the keep alive state is to true |
Task |
getTask()
|
boolean |
hasTask()
|
boolean |
isKeepAlive()
|
protected void |
resetPriority()
Restore the priority |
void |
run()
|
void |
setDefaultPriority(int defaultPriority)
Update the default thread priority. |
void |
setKeepAlive(boolean keepAlive)
Decide to maintain the current thread. |
void |
setLoopTask(boolean loop)
Decide to maintain the current task ( setTask )
in the thread. |
void |
setTask(Task task)
|
void |
setTask(Task task,
int priority)
|
void |
setTaskContext(TaskContext tc)
|
Methods inherited from class java.lang.Thread |
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getContextClassLoader, getName, getPriority, getThreadGroup, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setName, setPriority, sleep, sleep, start, stop, stop, suspend, toString, yield |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
protected Task coreThread
protected boolean keepAlive
Constructor Detail |
public ThreadCapsuleImpl()
setTask
is called
public ThreadCapsuleImpl(Task task)
Method Detail |
public void setDefaultPriority(int defaultPriority)
setDefaultPriority
in interface ThreadCapsule
protected void resetPriority()
public boolean hasTask()
hasTask
in interface ThreadCapsule
public void setTask(Task task)
setTask
in interface ThreadCapsule
public void setTask(Task task, int priority)
setTask
in interface ThreadCapsule
public void setTaskContext(TaskContext tc)
setTaskContext
in interface ThreadCapsule
public void run()
run
in interface java.lang.Runnable
run
in class java.lang.Thread
public void setLoopTask(boolean loop)
setTask
)
in the thread. The task will run until a new task takes its place
public void setKeepAlive(boolean keepAlive)
true
.
If you decide to set it to false
, you
will not have an effective run
method meaning
a task will not be run
setKeepAlive
in interface ThreadCapsule
public boolean isKeepAlive()
isKeepAlive
in interface ThreadCapsule
public Task getTask()
getTask
in interface ThreadCapsule
public void activateThreadCapsule()
true
activateThreadCapsule
in interface ThreadCapsule
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |