|
OSMQ v2.0.1 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectosmq.util.Threaded
Base class for objects that need a seperate thread to iteratively perform a task. Handles properly destroying the object when the thread terminates.
Field Summary | |
static int |
HIGH_PRIORITY
|
static int |
HIGHEST_PRIORITY
|
static int |
INCREASED_PRIORITY
|
static int |
VERY_HIGH_PRIORITY
|
Constructor Summary | |
Threaded()
|
Method Summary | |
ExceptionListener |
getExceptionListener()
|
long |
getIterations()
Returns the number of time the derived class's iterativeProces() has been invoked successfully. |
int |
getPriority()
|
int |
getSequenceNumber()
|
java.lang.String |
getUserDefinedName()
|
int |
getYieldToPeers()
|
boolean |
hasTerminated()
|
boolean |
isPaused()
|
boolean |
isRunning()
|
boolean |
isShutdownCompleted()
|
static void |
killAll()
|
static void |
killAllInGroup()
This function destroys all the threads derived from Threaded. |
void |
run()
|
void |
setExceptionListener(ExceptionListener listener)
Registers a listener that will be notified if the thread is being halted due to an exception that was thrown by the derived class's iterativeProcess() method. |
void |
setPaused(boolean p)
|
void |
setPriority(int priority)
|
void |
setUserDefinedName(java.lang.String name)
|
void |
setYieldCount(int yieldcount)
Used to control whether to give up time slice to threads with the same priority. |
boolean |
shutdownRequested()
|
static void |
sleepSecs(int secs)
|
static void |
sleepTenths(int secs)
|
void |
start()
This method first calls the derived class's initialize() method, and then begins iteratively executing the derived class's iterativeProcess() function. |
void |
stop()
Halt execution of the thread processing |
boolean |
successfulInit()
|
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final int INCREASED_PRIORITY
public static final int HIGH_PRIORITY
public static final int VERY_HIGH_PRIORITY
public static final int HIGHEST_PRIORITY
Constructor Detail |
public Threaded()
Method Detail |
public void setUserDefinedName(java.lang.String name)
public java.lang.String getUserDefinedName()
public static void killAllInGroup()
public void setExceptionListener(ExceptionListener listener)
public ExceptionListener getExceptionListener()
public boolean successfulInit()
public void start() throws java.lang.IllegalStateException
If an exception is thrown by the iterativeProcess() method, the exception listener (if one has been registered) will be notified.
As a final step when the thread is halted, whether by a stop() call or due to an exception being thrown, the derived class's cleanup() method will be called.
java.lang.IllegalStateException
- if the initialize() method fails or
a thread could not be started.setExceptionListener(ExceptionListener)
public void setYieldCount(int yieldcount)
yieldcount
- is the number of times to execute process before yielding
to peers. The default is DEFAULT_YIELD_COUNT. A value of 0
turns off yeilding.public int getYieldToPeers()
public long getIterations()
public final void run()
run
in interface java.lang.Runnable
public void setPriority(int priority)
public int getPriority()
public int getSequenceNumber()
public boolean isShutdownCompleted()
public static final void killAll()
public boolean isRunning()
public boolean hasTerminated()
public void stop()
public boolean shutdownRequested()
public void setPaused(boolean p)
public boolean isPaused()
public static void sleepTenths(int secs)
public static void sleepSecs(int secs)
|
(c) 2000 - 2003 MQue Systems All Rights Reserved |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |